cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Building add-in: User input for each column

Abby_Collins14
Level III

Hi! I am working on building a JMP script/add-in that automatically does TOSTs for a user selected number of columns. I have the scripting working to prompt the user to select the columns using the code below. However after that, I would like to have a window pop up that would allow the user to input the practical equivalence (or have an option to use a multiplier of the SD) for each selected column. Does anyone know how to do this or have good reference of where I could learn?

 

Thanks! 

 

Code for user input column picker:

 

dt = Current Data Table();
 
cnames = dt << Get Column Names(string);
n2 = N Items(cnames);
lstNumCol = dt << get column names(numeric);
New Window("Select Parametrs for Equivalence Testing",
	<<modal,
	clb = Col List Box(<<set items(lstNumCol))
);
lstColNames = clb << get selected;
Show(lstColNames);
n = Length(lstColNames);

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User


Re: Building add-in: User input for each column

There are many options, here is one using Table Box

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

cnames = dt << Get Column Names(string);
n2 = N Items(cnames);

lstNumCol = dt << get column names(numeric);

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, << return result,
	clb = Col List Box(<<set items(lstNumCol))
);

lstColNames = nw["clb"];


nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, 
	Table Box(
		String Col Box("column", lstColNames),
		Number Col Edit Box("practical equivalence ", Repeat([.], N Items(lstColNames)))
	)
);

Other good option could be Lineup Box and using Number Edit Boxes. You could also update your initial window dynamically based on user selections, but I would start with something simpler like having two modal windows.

 

I would also suggest you add Button Box("OK") and Button Box("Cancel") if you are using modal windows. JMP will automatically add "OK" button but if you add it yourself, you can trigger actions when user presses that and generally it nice to provide user an option to cancel (remember to check which button user did press).

-Jarmo

View solution in original post

jthi
Super User


Re: Building add-in: User input for each column

You can add Radio Box for user to select value from and then build your display boxes based on that selection. There are then plenty of different ways on how you wish to utilize the selection user has made, this is one of the simpler ones: just change the title of number col edit box

Names Default To Here(1); 

OPTIONS = {"practical equivalence", "sigma multiplier"};

dt = open("$SAMPLE_DATA/Big Class.jmp");

cnames = dt << Get Column Names(string);
n2 = N Items(cnames);

lstNumCol = dt << get column names(numeric);

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, << return result,
	clb = Col List Box(<<set items(lstNumCol)),
	rb = Radio Box(OPTIONS)
);

lstColNames = nw["clb"];
user_selection = nw["rb"];

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, 
	Table Box(
		String Col Box("column", lstColNames),
		Number Col Edit Box(OPTIONS[user_selection], Repeat([.], N Items(lstColNames)))
	)
);

Scripting Index does contain some good material about the display boxes, for example here Scripting Guide > Display Trees > Construct Custom Windows > Construct Display Boxes for New Windows 

-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User


Re: Building add-in: User input for each column

There are many options, here is one using Table Box

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

cnames = dt << Get Column Names(string);
n2 = N Items(cnames);

lstNumCol = dt << get column names(numeric);

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, << return result,
	clb = Col List Box(<<set items(lstNumCol))
);

lstColNames = nw["clb"];


nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, 
	Table Box(
		String Col Box("column", lstColNames),
		Number Col Edit Box("practical equivalence ", Repeat([.], N Items(lstColNames)))
	)
);

Other good option could be Lineup Box and using Number Edit Boxes. You could also update your initial window dynamically based on user selections, but I would start with something simpler like having two modal windows.

 

I would also suggest you add Button Box("OK") and Button Box("Cancel") if you are using modal windows. JMP will automatically add "OK" button but if you add it yourself, you can trigger actions when user presses that and generally it nice to provide user an option to cancel (remember to check which button user did press).

-Jarmo
Abby_Collins14
Level III


Re: Building add-in: User input for each column

amazing, thank you!!

 

My main goal is to have a window pop up first that asks the user if they would like to enter a practical equivalence or use a multiplier of the standard deviation, and if they pick a multiplier of the SD they can then input "3" or whatever value. Is this possible?

 

Thank you so much for your help!

 

Abby 

jthi
Super User


Re: Building add-in: User input for each column

You can add Radio Box for user to select value from and then build your display boxes based on that selection. There are then plenty of different ways on how you wish to utilize the selection user has made, this is one of the simpler ones: just change the title of number col edit box

Names Default To Here(1); 

OPTIONS = {"practical equivalence", "sigma multiplier"};

dt = open("$SAMPLE_DATA/Big Class.jmp");

cnames = dt << Get Column Names(string);
n2 = N Items(cnames);

lstNumCol = dt << get column names(numeric);

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, << return result,
	clb = Col List Box(<<set items(lstNumCol)),
	rb = Radio Box(OPTIONS)
);

lstColNames = nw["clb"];
user_selection = nw["rb"];

nw = New Window("Select Parametrs for Equivalence Testing",
	<<modal, 
	Table Box(
		String Col Box("column", lstColNames),
		Number Col Edit Box(OPTIONS[user_selection], Repeat([.], N Items(lstColNames)))
	)
);

Scripting Index does contain some good material about the display boxes, for example here Scripting Guide > Display Trees > Construct Custom Windows > Construct Display Boxes for New Windows 

-Jarmo
Abby_Collins14
Level III


Re: Building add-in: User input for each column

Thank you so much this is very helpful!

Abby_Collins14
Level III


Re: Building add-in: User input for each column

if they pick "sigma multiplier" can that prompt a different window that would be just one box for all parameters? i.e. the sigma multiplier would be the same for all columns so they only need to enter it once.

 

Thanks for the help!!

jthi
Super User


Re: Building add-in: User input for each column

Sure, you can for example use If statement to check what the user did select and then create the window accordingly.

-Jarmo