cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
gpilgrim
Level II

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

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: blob to data table

I have unarchived that post .

-Jarmo

View solution in original post

6 REPLIES 6

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!

gpilgrim
Level II

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

jthi
Super User

Re: blob to data table

I have unarchived that post .

-Jarmo
gpilgrim
Level II

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

ErraticAttack
Level VI

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 );
Jordan
gpilgrim
Level II

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