Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
ivomdb
Level III

How to save and close combined tables into a file?

Hello All, 

 

Please see the following bit of script. I am trying close and save the estimates and errors table into files. However, for some reason the commands do not do anything and adter running the whole script I still have these two tables open. What Am I doing wrong?

 

Thanks

_xx = obj << Xpath("//OutlineBox[@helpKey='Nonlinear Solution']");
//only 2 groups so only 2 are found; each contains two sub tables

fit_dt = (_xx[1]<<Find(TableBox(1))) << Make Combined Data Table;
est_dt = (_xx[1]<<Find(TableBox(2))) << Make Combined Data Table;
fit_dt << set Name("NonLin Fit Errors");
est_dt << set Name("NonLin Fit Estimates");

Names Default To Here( 1 );

DontClose = {"dt4","NonLin Fit Errors","NonLin Fit Estimates"};   // Example names of tables you want to leave
// Loop backwards through the list, so the table numbers do not change
For( i = N Table(), i >= 0, i--, 
	If( Contains( DontClose, Data Table( i ) << get name ),
		Continue(),
		Close( Data Table( i ), "No Save" )
	)
);

dt=Current data table ("NonLin Fit Errors");
dt<<Save("C:\Users\ioliveira\Desktop\data\errors XXXXXX.jmp");
Close(dt);

dt1=Current data table ("NonLin Fit Estimates");
dt1<<Save("C:\Users\ioliveira\Desktop\data\estimates XXXXXX.jmp");
Close(dt1);
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: How to save and close combined tables into a file?

Things to check:

There might be a message in the log.

The loop is setup to count down to zero. It should probably stop at one. (That's related to the message that might be in the log that might be stopping the script.) If you think the script is stopping without warning, add a print or show statement here and there; within the loop you might want

show( Data Table( i ) << get name );

just to know it is working as expected.

 

Alternate approach:

You already have the variables for the tables you want to save; you can use them directly. 

fit_dt<<save(...);
close(fit_dt);

and avoid current data table(). And now I see you are using current data table with an argument; perhaps that should just be data table("xxx") instead. I'm pretty sure that's related as well.

 

Craige

View solution in original post

1 REPLY 1
Highlighted
Craige_Hales
Staff (Retired)

Re: How to save and close combined tables into a file?

Things to check:

There might be a message in the log.

The loop is setup to count down to zero. It should probably stop at one. (That's related to the message that might be in the log that might be stopping the script.) If you think the script is stopping without warning, add a print or show statement here and there; within the loop you might want

show( Data Table( i ) << get name );

just to know it is working as expected.

 

Alternate approach:

You already have the variables for the tables you want to save; you can use them directly. 

fit_dt<<save(...);
close(fit_dt);

and avoid current data table(). And now I see you are using current data table with an argument; perhaps that should just be data table("xxx") instead. I'm pretty sure that's related as well.

 

Craige

View solution in original post

Article Labels

    There are no labels assigned to this post.