cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
PChemMan
Level I

Running a JMP script without associated table

I have a JMP script that launches a SQL query and then processes the datatable that results.   Then it does a series of column manipulations and other table operations.   When I execute the script in the JSL builder it still lists a datatable in the box next to the "play" button.  Even though I have "NamesDefaultToHere(1)", it will often still alter columns in the table listed in the box of the JSL window (if they have the same column names) - instead of the table generated by the SQL query.   Is there a line to the script I can add to prevent this behavior?  For example, with the below script - if the existing table has a column "DIEID" it will get changed and not the SQL datatable created by the script.  If there are no tables open, it works correctly.  

 

Thanks and let me know if you need additional information.

 

NamesDefaultToHere(1);

query = open("C:\Users\tbaker1\Documents\JMP Scripts\IgniteRuns_V2.jmpquery",Private);

dtIGNITE = query << Run Foreground();
dtIGNITE << show window(1);

dtIGNITE << New Column("DIEID");
Column("DIEID") << Formula(If(
	!Is Missing( :Name( "Old-DieID" ) ), :Name( "Old-DieID" ),
	!Is Missing( :Name( "EEPROM-FCSerialNumber" ) ), :Name( "EEPROM-FCSerialNumber" ),
	"Missing"));

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Running a JMP script without associated table

To specify that the dtIGNITE table be current, the syntax would be:

Current Data Table( dtINGNITE );

Since the Baselines-EXT table has the same name columns, try adding the optional column reference to your Column() functions.  This tells JMP which table to look at for the DIEID and FCID columns.

Column( dtIGNITE, "DIEID" ) << Formula( <formula> );

Alternately, you could combine the New Column() and Formula() lines.

Hope that helps!

Wendy

View solution in original post

5 REPLIES 5
uday_guntupalli
Level VIII

Re: Running a JMP script without associated table

@PChemMan
       I am not sure I follow your question correctly. Kindly provide a more detailed explanation in your response if what I try here does not help.

       But, making a few assumptions, let's see you have 2 tables - 1 table is called "dtIGNITE" , the other one, lets call it "SQLTable" for now . You are concerned that your script makes changes to the dtIGNITE table instead of the SQLTable ? 
      If that is so - can you try adding the following piece of code 

Current Data Table = Data Table("SQLTable"); 

     before any manipulations are performed. This should make the SQL generated table the current table. 

 

 

Best
Uday
PChemMan
Level I

Re: Running a JMP script without associated table

I've attached a screen shot that may help.  

 

I typically run my scripts from the editor window.   dtIGNITE is the table generated by the SQL table, but when I run the script, the table "Baselines-Ext" will be modified since it is listed as the current data table in the GUI.

 

I added the lines :

dtIGNITE << Set Name ("RUNS");
Current Date Table = Data Table("RUNS");

 to my jsl, but that did not fix the issue.  

 

If there are no other tables open in JMP, the script works perfectly as written.

 

I will try the debug option and update if I find something.

 

 

Picture1.png

Re: Running a JMP script without associated table

To specify that the dtIGNITE table be current, the syntax would be:

Current Data Table( dtINGNITE );

Since the Baselines-EXT table has the same name columns, try adding the optional column reference to your Column() functions.  This tells JMP which table to look at for the DIEID and FCID columns.

Column( dtIGNITE, "DIEID" ) << Formula( <formula> );

Alternately, you could combine the New Column() and Formula() lines.

Hope that helps!

Wendy
PChemMan
Level I

Re: Running a JMP script without associated table

Between my typo of Data to Date and some of my own confusion on scope/variable - your solution worked.  Below is the final script as implemented.  

 

Thanks for your help!

 

NamesDefaultToHere(1);

query = open("C:\Users\tbaker1\Documents\JMP Scripts\IgniteRuns_V2.jmpquery",Private);


dtIGNITE = query << Run Foreground();
Current Data Table (dtIGNITE);

dtIGNITE << New Column("DIEID");
Column("DIEID") << Formula(If(
	!Is Missing( :Name( "Old-DieID" ) ), :Name( "Old-DieID" ),
	!Is Missing( :Name( "EEPROM-FCSerialNumber" ) ), :Name( "EEPROM-FCSerialNumber" ),
	"Missing"));

Re: Running a JMP script without associated table

You might consider:

dt1 = New Table( "dtIgnite" );
query << Run Foreground( UpdateTable( dt1 ) );
Wait(0);
dt1 << New Column(...

It might give more consistent results to assign the handle to the table and then update it.