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
elad
Level I

Need help with JSL code for table save and close

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

Re: Need help with JSL code for table save and close

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

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Need help with JSL code for table save and close

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
Level I

Re: Need help with JSL code for table save and close

thx
elad
Level I

Re: Need help with JSL code for table save and close

Thx for the help. 

 

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

txnelson
Super User

Re: Need help with JSL code for table save and close

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
Level I

Re: Need help with JSL code for table save and close

Thx you have been a great help.