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
ih
ih
Level VII

Missing data table - closed automatically?

Am I doing something wrong here or is this a bug?  Run the code below in either JMP 14 or 15 one command at a time and three tables are open at the end.  Run it all at once and one table either never opens in the GUI or closes automatically, evidenced by an error on the last line.

// This script should open 2 tables and create a third based on the first two.
// Run script line by line and all three are open at the end.  Run all at once
// and the first table, dtDD, is not open when the script is finished.

names default to here(1);

dtDD = Open("$Sample_Data/Big Class.jmp");

dtDDOld = Open("$Sample_Data/Big Class Families.jmp");

if(left(jmpversion(),2) == "15",
	dtDDOld << Delete Row( 1 ); //not sure why this didn't delete a row in JMP 14...
,
	dtDDOld << select where( row() == 1 );
	dtDDOld << delete rows();
);

//find new tags
dtDDNew = New SQL Query(
	Version( 130 ),
	Connection( "JMP" ),
	
	QueryName( "New Query" ),
	Select(
		Column( "name", "t1" ),
		Column( "age", "t1" ),
		Column( "sex", "t1" ),
		Column( "name", "t2", Alias( "name 2" ) )
	),
	From(
		Table( dtDD << Get Name, Alias( "t1" ) ),
		Table(
			dtDDOld << Get Name,
			Alias( "t2" ),
			Join(
				Type( Left Outer ),
				EQ( Column( "name", "t1" ), Column( "name", "t2" ) )
			)
		)
	),
	Where(
		Custom(
			"t2.\!"name\!" is null and (t1.\!"name\!" is not null)",
			UI( Custom( Base( "Continuous" ) ) )
		)
	)
) << Run;

dtDD << bring window to front;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Missing data table - closed automatically?

The JMP interpreter processes the JSL statements one after another, and does not necessarily wait for steps above in the code to complete, before subsequent statements are being processed. That is, some statements run in the background, as the JSL continues to process.  I believe this is what is happening. You can force the JSL to wait in a couple of ways.  Using a

     Wait(0);

or 

     dtDD << rerun formulas;

will force JSL to pause before processing.

I placed a Wait(0) after the Open() functions for the Big Class and Big Class Families and also just before the 

     dtDD << bring window to front;

The result was the proper execution of your JSL.

Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: Missing data table - closed automatically?

The JMP interpreter processes the JSL statements one after another, and does not necessarily wait for steps above in the code to complete, before subsequent statements are being processed. That is, some statements run in the background, as the JSL continues to process.  I believe this is what is happening. You can force the JSL to wait in a couple of ways.  Using a

     Wait(0);

or 

     dtDD << rerun formulas;

will force JSL to pause before processing.

I placed a Wait(0) after the Open() functions for the Big Class and Big Class Families and also just before the 

     dtDD << bring window to front;

The result was the proper execution of your JSL.

Jim

View solution in original post

Highlighted
ih
ih
Level VII

Re: Missing data table - closed automatically?

So far I've only ran into that problem when future statements try to execute before the first one completes.  In this case the first statement either never really completes at all (data is loaded, just not made available via that variable); or the table is subsequently closed, which is not part of the script.  Adding wait does fix it though. I will see what JMP support thinks.

 

Thank you

Article Labels

    There are no labels assigned to this post.