- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
blob to data table
I have a blob, output from runprogram. The blob looks like this
blb = Char To Blob ("col1,col2~0D~0D~0AA,C~0D~0D~0AB,D~0D~0D~0A", "ascii~hex")
I'd like to convert it to a data table.
This post indicates that Open() can open a blob, but
Open(blb)
does not work.
"Cannot open tale in access or evaluation of 'Open', Open/*###*/(blb)".
RunProgram can also return text, but then I need to convert a string to a data table, which seems fussy.
I'd like a scripting solution please, JMP v 15
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
The Open() function works with files. The argument should be a file path. You have to stream the blog out first before you can open it. The discussion you cited uses Open() after a string is saved to a text file in a format similar to CSV. Craig suggests that Open() works with a blog as the argument instead of a path, but that is not explicitly tried.
Have you confirmed that the Char to Blob() function returns a valid blob?
Sorry - I am confused now!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
1) Char to Blob and its contents are what is returned by call to RunProgram
2) The actual output of the non-JMP program called in RunProgram is a csv file written to stdout. I do not want to write the csv to a file location, so no file path
3) From the linked discussion it seems like using a blob instead of a path in Open was tried here, but that post is no longer available for some reason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
I have unarchived that post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
Thank you!
The key, as shown in the unarchived post you shared is
Open(blb, "text")
That solves my problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
I'm not sure how you're getting your blob or whether it's correctly formatted, but here is an example where I save a data table as a standard JMP file, then read it in as a blob. Once I have that blob it's quite simple to convert it into a table (last line)
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Save( "$TEMP\BLOB_TEST.jmp" );
Close( dt, No Save );
file = Load Text File( "$TEMP\BLOB_TEST.jmp", "Blob" );
table = Open( file, JMP );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: blob to data table
The blob comes from RunProgram, with ReadFunction set to "blob". The program being called in RunProgram writes a csv to stdout, where it's picked up by RunProgram and returned as a blob. I can also have it returned as text, but like I said, parsing text into a data frame seems fussy. If I'm wrong about that please let me know.
What I don't want to do is have the non-JMP program write an actual csv file and then open that, because juggling temporary csv files will not work in my application