cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
Diana_JMP
Level I

generic scripting of data table

I want to create a generic script to create a data table.

In the first part of the Script I have a list to select columns for creation of data table:

nw = New Window("Create data table",
	<<Type("Modal Dialog"),
	<<Return Result,
	V List Box(
		Spacer Box(size(0, 15)),
		Text Box(
			"Please select the limits to display in data table (multiple selection posssible): "
		),
		Spacer Box(size(0, 5)),
		clb_limit = Col List Box(all, <<Set Data Type("numeric"), width(250)),
		Spacer Box(size(0, 15)),
		H List Box(Button Box("OK"), Button Box("Cancel"))
	),
);

//Extract variables from entry form and put them into separate
list names_limit = nw["clb_limit"];
Show(names_limit);



In the second part the I need a script which creates a data table depending on selected columns (numbers of columns and names of column are different). Below two examples for normal script (not generic):

 

Example1:

dt_data = Current Data Table();
dt_LimitCalc = dt_data << Summary(
	Group(:GROUP, :CHART, :EVALUATION, :NAME),
	N(:VALUE),
	Mean(:VALUE),
	Std Dev(:VALUE),
	Mean(:Limit1),
	Mean(:Limit2),
	Freq("None"),
	Weight("None")
);

Example 2:

dt_data = Current Data Table();
dt_LimitCalc = dt_data << Summary(
	Group(:GROUP, :CHART, :EVALUATION, :NAME),
	N(:VALUE),
	Mean(:VALUE),
	Std Dev(:VALUE),
	Mean(:xy_Limit),
	Mean(:Limi_xy),
	Mean(:Lim_123),
	Freq("None"),
	Weight("None")
);

jthi_1-1754312216002.png


Can somebody helps to create a generic script depending on selected columns? Only the bold part changes. All other parts are the same.

 

Edit (jthi): Added JSL formatting and image of bolded parts

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: generic scripting of data table

You can pass your list to Mean with Eval

dt << Summary(
	Mean(Eval(list names_limit))
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: generic scripting of data table

You can pass your list to Mean with Eval

dt << Summary(
	Mean(Eval(list names_limit))
);
-Jarmo

Recommended Articles