cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Jackie_
Level VI

Call function in checkbox

Hi,

 

I am building a simple interface for the user and have a window to set some options using check boxes. 

I am currently able to make the first call function and the script filters the string "SE" from the columns and generates outliers. However, if I check 2nd and 3rd checkbox it does not call the function

 

 I tried the following script:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");

check_list = {"SS", "SE", "PH"};

todo_list  = {};


nw = new window("Checkboxes", << modal(),

     my_cb = checkbox(check_list),

     panelbox("Actions",

           hlistbox(

                button box("OK",

                     keep_going = 1;

                     todo_list = my_cb << get selected;

                ),

                button box("Cancel", keep_going = 0)

           ),

     ),

);

nt = nitems(todo_list);
colList = dt << Get Column Names("String");
filteredCols = {};


if (keep_going & nt > 0,

     for (i = 1, i <= nt, i++,

           if (todo_list[i] == "SS",

//              Call function for One step

For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SS"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
	Y((Eval(filteredCols) )));

obj << Quantile Range Outliers;
obj << Select Rows(All);
                ,

                todo_list[i] == "SE",

//              Call function for Two step

               For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "SE"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
	Y((Eval(filteredCols) )));

obj << Quantile Range Outliers;
obj << Select Rows(All);
				,
				todo_list[i] == "PH",

//              Call function for Three step

               For(i = 1, i <= N Items(colList), i++,
	If(Contains(colList[i], "PH"), Insert Into(filteredCols, colList[i]))
);
obj = dt <<
Explore Outliers(
	Y((Eval(filteredCols) )));

obj << Quantile Range Outliers;
obj << Select Rows(All);


           );

     );

);

Looking for some feedback

 

Thanks,

Jack

1 REPLY 1
txnelson
Super User

Re: Call function in checkbox

You are using the index "i" for all of your For() loops.  That means that the value of "i" is getting changed all over the place.  You need to use different variables for your For() loops when there is a loop within a loop. 

Jim

Recommended Articles