BookmarkSubscribeSubscribe to RSS Feed

Is it possible for a jsl script to edit itself?

Highlighted
shaira

Community Trekker

Joined:

May 4, 2017

Hi,

I wanted to modify a jsl script during execution. Reason is as follows. I made a GUI for parameter correlation. The column list box, check boxes, and text edit boxes have set default value. I added the "Set Current as Default" button which means that whatever is currently inputted in the boxes will be the new default.

 

Below is the script copy for GUI only. What I want is to overwrite the values in the SetDef block if the user presses the "Set Current As Default" button.

 

Thanks for the help.

 

 

dt = Current Data Table();

SetDef = Expr(
			  // Set Default Values
			  corrcoldef = {:Name("ColName1")};
			  fitcoldef  = {:Name("ColName2")};
			  parcoldef  = {:Name("ColName3"),:Name("ColName4")};
			  grpcoldef  = {:Name("ColName7"),:Name("ColName8")};
			  
			  chkb1 = 0; //Uncheck Fit Y by X				
			  chkb2 = 1; //Check Fit Y by X (m=1)
			  chkb3 = 1; //Check Output R^2 and Offset Table
			  chkb4 = 0; //Uncheck Output Static JMP report
			  ncolval = 4; //Number of plots per row in report window
);

GUI = Expr(
			reflist = {};
			nw = New Window ("Correlate",
							TextBox("   Generates one-to-one correlation plots."),
							SpacerBox(Size(1,10)),
							H List Box (
										SpacerBox(Size(10,1)),
										V List Box (
														Panel Box("Select Columns", 
																  ColSource = ColListBox(dt, all, nlines(18)),
																 ),
														SetDefb = Button Box("Set Current as Default")
																	
													),
													
										SpacerBox(Size(5,1)),		
											
										V List Box ( 
													Panel Box ("",
																Line Up Box ( Ncol(2),
																			 corrb = Button Box("Correlate By"),
																			 corrcol = ColListBox(dt,Min Items(1),Max Items(1), nlines(1)),
																			 fitb = Button Box("Fit Line By"),
																			 fitcol = ColListBox(dt,Max Items(1), nlines(1)),
																			 TextBox(" Reference"),
																			 refcombo = Combo Box (reflist),
																			 parb = Button Box ("Parameters"),
																			 parcol = ColListBox (dt, Min Items(1), nlines(8), <<Set Data Type(Numeric)),
																			 grpb = Button Box ("Group"),
																			 grpcol = ColListBox (dt, nlines(5)),
																			 //byb = Button Box ("By"),
																			 //bycol = ColListBox (dt, nlines(3)),
																			)
															 ),
													Panel Box ("",
															   chkb = Check Box ( {"Fit Y by X",
																				   "Fit Y by X (m=1)",
																				   "Output R^2 and Offset Table",
																				   "Output Static JMP report"
																				   },
																				   
																				),
															   chkb << set(1, chkb1), //Check or uncheck Fit Y by X				
															   chkb << set(2, chkb2), //Check or uncheck Fit Y by X (m=1)
															   chkb << set(3, chkb3), //Check or uncheck Output R^2 and Offset Table
															   chkb << set(4, chkb4), //Check or uncheck Output Static JMP report
															   
															   nc = H List Box(TextBox("Number of plots per row?"), 
																			   ncol = TextEditBox(ncolval)	
																			   )
															  )
															 
													
													),
													
										SpacerBox(Size(5,1)),
												 
										Panel Box ("Action",
													OKb = Button Box("OK"),
													Cancelb = Button Box("Cancel"),
													Removeb = Button Box("Remove"),
													Recallb = Button Box("Recall"),
													Defaultb = Button Box("Default"),
												   )
										
										 
										)
							);
				corrcol << Set Items(corrcoldef);
				fitcol  << Set Items(fitcoldef);
				parcol	<< Set Items(parcoldef);
				grpcol 	<< Set Items(grpcoldef);	
			);
			

SetDef;
GUI;




 

1 ACCEPTED SOLUTION

Accepted Solutions
shaira

Community Trekker

Joined:

May 4, 2017

Solution

I suddenly had an idea. Store the default values in an external text file and modify that file instead.

But still, if there are better ideas, please let me know. :)

 

Thanks,

Shaira

1 REPLY
shaira

Community Trekker

Joined:

May 4, 2017

Solution

I suddenly had an idea. Store the default values in an external text file and modify that file instead.

But still, if there are better ideas, please let me know. :)

 

Thanks,

Shaira