cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Neo
Neo
Level VI

How to make a checkbox list for user input based on items in a column of a datatable?

I have a data table with one of the columns having names of different tests conducted on parts. Other columns have other test related data.

I want to make a user interface where these test names are available as check boxes for user input to be used in the next stage of my JSL script. I would like have a warning (with stop further execution) if more than or less than two items selected via these check boxes. How to achieve this via JSL? Test names appear repeated in its column and I do not want repeats to show in the check box.

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to make a checkbox list for user input based on items in a column of a datatable?

Use Summarize (or many other options) to get the unique values from column into a list and then use that to initialize your check box

Names Default To Here(1);

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

Summarize(dt, user_options = By(:name));
nw = New Window("", << modal, << return result,
	V List Box(
		cb = Check Box(user_options),
		Lineup Box(N Col(2),
			Button Box("OK"),
			Button Box("Cancel")
		)
	)
);

If(nw["Button"] != 1 | N Items(nw["cb"]) != 2,
	stop();
);

show(user_options[nw["cb"]]);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to make a checkbox list for user input based on items in a column of a datatable?

Use Summarize (or many other options) to get the unique values from column into a list and then use that to initialize your check box

Names Default To Here(1);

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

Summarize(dt, user_options = By(:name));
nw = New Window("", << modal, << return result,
	V List Box(
		cb = Check Box(user_options),
		Lineup Box(N Col(2),
			Button Box("OK"),
			Button Box("Cancel")
		)
	)
);

If(nw["Button"] != 1 | N Items(nw["cb"]) != 2,
	stop();
);

show(user_options[nw["cb"]]);
-Jarmo