- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am writing a .net ectd viewer app for a client int Windows Forms and one of the format it needs to read and display is .xpt file.I have installed the 32 bit & 64 bit interrop clients. Any guidance is much appreciated.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It 100% leads to a C# project but let me help clarify a bit.
To read the xpt format, using C# code, you can do it w/o any drivers. I am not sure what drivers you downloaded and, if they are allowed to be used in anothe rproject.
You can read the file natively since the layout is published. However, the numbers are expressed in IBM floating point format so you need to convert them to .NET.
For the xpt file layout, see this article: https://documentation.sas.com/?docsetId=movefile&docsetTarget=p0ld1i106e1xm7n16eefi7qgj8m9.htm&docse...
When you read the file in, convert the numbers, from IBM mainframe layout, to doubles (I believe) using the article I sent you.
If I get a chance, I will push out a .NET Core version of my C# code. When do you need to support it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Format is published by SAS.
I wrote a C# reader/writer for it a number of years ago. Killer is the IBM floating point conversion. Look for my Code Project article on it if you need to go that route: https://www.codeproject.com/Articles/492449/Transform-between-IEEE-IBM-or-VAX-floating-point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It 100% leads to a C# project but let me help clarify a bit.
To read the xpt format, using C# code, you can do it w/o any drivers. I am not sure what drivers you downloaded and, if they are allowed to be used in anothe rproject.
You can read the file natively since the layout is published. However, the numbers are expressed in IBM floating point format so you need to convert them to .NET.
For the xpt file layout, see this article: https://documentation.sas.com/?docsetId=movefile&docsetTarget=p0ld1i106e1xm7n16eefi7qgj8m9.htm&docse...
When you read the file in, convert the numbers, from IBM mainframe layout, to doubles (I believe) using the article I sent you.
If I get a chance, I will push out a .NET Core version of my C# code. When do you need to support it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I accepted the solution too soon. I cant find anywhere a .xpt file is opened and read. I can see where these converters can come in use. But I dont see how the .xpt file is being imported to be read. Could you clarify that please? Thanks a bunch in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No issues. I will get the actual code base prepared and pushed to nuget as a package. I don't believe I will release source code just yet but should be able to get a dll together.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It will be under Savian.SaviTransport in nuget. I just published it but this is my #1 publish on the public nuget. I expect to make a number of changes depending upon what you find. A simple test with shoes.xpt was successful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I installed the nuget in a .net core project. Since its not documented I am not sure what method to use. For instance I have a d:\sample.xpt file. How can I import this? What method can I use. For ex: It would be simple to have something like Savian.SaviTransport.ImportXpt(d:\sample.xpt).
Also would it be too much to ask for .net 4.8 or compatible too? I greatly appreciate your patience and help.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The package is documented. See here under documentation: https://www.nuget.org/packages/Savian.SaviTransport/#
This should be .NET Standard compatible. I can check on it some more (again, my first nuget publish). I checked the nupkg file (just rename to zip to see inside) and the dll is in there under lib. I am not familiar with nuget packaging but I assume it was done correctly by Visual Studio. Here is a simple example showing the new object, xptLib, that contains everything. The docs also show how to export the data into various formats.
var engine = new Savian.SaviTransport.Engine();
var options = new Savian.SaviTransport.Options()
{
XptFile = _xptFile
};
var xptLib = engine.Process(options);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I updated the documentation on nuget and also switched the build from .NET Core 3.1 to .NET Standard 2.1. That should allow use in any .NET version that supports standard (includes Core and Framework). Hence, try the nuget package directly in Framework first before trying the dll directly. It should work.
See Hanselman's blog post for details: https://www.hanselman.com/blog/HowToReferenceANETCoreLibraryInWinFormsOrNETStandardExplained.aspx
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Did you download the latest? It has dependencies on System.Text.Json (standard) and System.ComponentModel.Annotations (standard) but they should have been bundled. Try adding them and see if that works. If so, i can update the build and somehow force the integration.
Also, it might better to work out the details offline and then post that it is operational. Feel free to reach out via the nuget channel and then we can let everyone know once it is operational.