Subscribe Bookmark RSS Feed

Need help with JSL code for table save and close

elad

Occasional Contributor

Joined:

Oct 26, 2017

Hi , 

 

I I'm new to JSL and i need help with the following :

//Open a csv table with a Button Box.

 

Lot_Tracker_window=New Window("Lot tracker", Lot_Tracker = Button Box("Lot tracker", dt=open("C:\Users\user\Documents\Temp\Lot tracker.csv")) );

 

//After i make changes in dt table by aditing the JMP table window. I want to Save&Close my changes to the original file "Lot tracker.csv", by using a new Button Box that i want to popup when i click  Lot_Tracker Button Box. what am i doing wrong?

 

New Window("Save To Lot Tracker", Save_Lot_Tracker = Button Box("Save To Lot Tracker", dt << save("C:\Users\user\Documents\Temp\Lot tracker.csv")));

Quit()

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Not in this case, however, you can actually just embed the second piece of code inside the button box in the first window, and you will get what you want.

Lot_Tracker_window = New Window( "Lot tracker",
	Lot_Tracker = Button Box( "Lot tracker", 
		dt = Open( "C:\Users\user\Documents\Temp\Lot tracker.csv" );
		Lot_Tracker_window << close window;
		New Window( "Save To Lot Tracker",
			Save_Lot_Tracker = Button Box( "Save To Lot Tracker",
				dt << save( "C:\Users\user\Documents\Temp\Lot tracker.csv" );
				Quit();
			)
		);
	)
);
Jim
5 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

I believe your issue is that the way you have your code setup, you are assuming that JMP will wait for you to complete each step before moving on.  However, the default in JSL is to continue processing further statements, until the code is complete(without pausing).  Therefore, your code will pop up the two windows, and then see the Quit() and stop processing.  What you need to do, it to do, is to make the first window a Modal window, and then to embed the Quit() function into the second window, so that it will be executed only after the Save button is pushed.

//Open a csv table with a Button Box.
 
Lot_Tracker_window = New Window( "Lot tracker",
	modal,
	Lot_Tracker = Button Box( "Lot tracker",
		dt = Open( "C:\Users\user\Documents\Temp\Lot tracker.csv" )
	)
);
 
//After i make changes in dt table by aditing the JMP table window. 
//I want to Save&Close my changes to the original file "Lot tracker.csv", 
//by using a new Button Box that i want to popup when i click  
//Lot_Tracker Button Box. what am i doing wrong?
 
New Window( "Save To Lot Tracker",
	Save_Lot_Tracker = Button Box( "Save To Lot Tracker",
		dt << save( "C:\Users\user\Documents\Temp\Lot tracker.csv" );
		Quit();
	)
);
Jim
elad

Occasional Contributor

Joined:

Oct 26, 2017

thx
elad

Occasional Contributor

Joined:

Oct 26, 2017

Thx for the help. 

 

Is it posible to use the modal without the OK button?

txnelson

Super User

Joined:

Jun 22, 2012

Solution

Not in this case, however, you can actually just embed the second piece of code inside the button box in the first window, and you will get what you want.

Lot_Tracker_window = New Window( "Lot tracker",
	Lot_Tracker = Button Box( "Lot tracker", 
		dt = Open( "C:\Users\user\Documents\Temp\Lot tracker.csv" );
		Lot_Tracker_window << close window;
		New Window( "Save To Lot Tracker",
			Save_Lot_Tracker = Button Box( "Save To Lot Tracker",
				dt << save( "C:\Users\user\Documents\Temp\Lot tracker.csv" );
				Quit();
			)
		);
	)
);
Jim
elad

Occasional Contributor

Joined:

Oct 26, 2017

Thx you have been a great help.