cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to get get text output from Run Program () into a data table?

I use an executable which pulls data from the database, does some data manipulation and makes manipulated data available to the end user. I would like to call this executable from within JMP and get the data into a data table. The following script example generates the data as text in the log. How do I get this text into a data table with the top row as column headers?

Names Default To Here (1);
Clear Log ();

rp = RunProgram( 
               Executable( "C:\dataFetchCmd\dataFetchCmd.exe" ),
               //Options(),
			   ReadFunction("text");
);

 

When it's too good to be true, it's neither
2 REPLIES 2
jthi
Super User

Re: How to get get text output from Run Program () into a data table?

Depends what you get back from run program. Sometimes using Open(Char To Blob(), "text") might be enough and sometimes not (like below)

Names Default To Here(1);
RP = Run Program(
	Executable("PING.EXE"/*path probably not needed*/ ),
	Options({"-n 2", "localhost"}),
	ReadFunction("text")
);
show(rp);

dt = Open(Char To Blob(RP), "text");

If it is not enough you either modify the data after you have it in data table or before you build it into data table

-Jarmo
pmroz
Super User

Re: How to get get text output from Run Program () into a data table?

You can use log capture and words to get the log window output and parse it.

// OK we're good to go now.
batch interactive(1);	// New 5-17-2018 force all errors to go to the log
log_contents = log capture(
// Put your commands that write to the log here ...
	);
batch interactive(0);	// New 5-17-2018 errors will not be forced to go to the log

// Parse the log window
crlf = hex to char("0D0A");
log_list = words(log_contents, crlf);