cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Jackie_
Level VI

Display a text box asking for input from the user

Hi,

 

I want to add Text edit box asking user to enter values for Q and Tail quantile to explore outliers. Here is what I tried but seems like I'm missing something. Can you advise that might help with this?

 

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

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

todo_list  = {};


nw = new window("Checkboxes", << modal(),
               "Input",
               V List Box( Text Box( "Enter Tail Quantile " ), tail = Text Edit Box() ,
							
							Text Box( "Enter Q Value " ), quan = Text Edit Box() ),

     my_cb = checkbox(check_list),

     panelbox("Actions",

           hlistbox(

                button box("OK",
					ta = tail << get text();
					qu = quan << get text();
                     keep_going = 1;

                     todo_list = my_cb << get selected;
                ),

                button box("Cancel", keep_going = 0)

           ),

     ),

);
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 << Tail Quantile (ta);
obj << Q(qu);
obj << Select Rows(All);

 

5 REPLIES 5
txnelson
Super User

Re: Display a text box asking for input from the user

Both the Tail Quantile and Q entries need to be numeric, not string/text.  Use the Num() function to convert.

Jim
pmroz
Super User

Re: Display a text box asking for input from the user

A few modifications - your original code didn't initialize a few things.  I used number edit box() and lineup box() for a nicer look.  Number edit box only allows entry of numbers.

pmroz_0-1631298965182.png

 

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Water Treatment.jmp");
check_list = {"SS", "SE", "PH"};
todo_list  = {};

nw = new window("Checkboxes", << modal(),
               text box("Input"),
               Lineup Box( N Col( 2 ),
					Text Box( "Enter Tail Quantile: " ), tail = number Edit Box() ,
					Text Box( "Enter Q Value:       " ), quan = number Edit Box()
				 ),

     my_cb = checkbox(check_list),
     panelbox("Actions",
           hlistbox(
                button box("OK",
					ta = tail << get();
					qu = quan << get();
                     keep_going = 1;
                     todo_list = my_cb << get selected;
                ),
                button box("Cancel", keep_going = 0)
           ),
     ),
);

collist = dt << get column names(string);
filteredcols = {};
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 << Tail Quantile (ta);
obj << Q(qu);
obj << Select Rows(All);
Jackie_
Level VI

Re: Display a text box asking for input from the user

Thanks @pmroz ,

 

The script work fine but the problem is it take the default values to evaluate the outliers not the input values. See the screen shot below 

 

The following analysis is based on Tail Quantile of 0.1 and Q of 3. I entered 0.4. and 3 in the edit box. I tired using redo analysis but it doesn't selects all rows in the window. Any advice?

Jacksmith12_1-1631323056002.png

 

 

Jackie_
Level VI

Re: Display a text box asking for input from the user

@pmroz any advice?

pmroz
Super User

Re: Display a text box asking for input from the user

I would try reverse engineering the analysis.  Do the analysis manually with the desired parameters/columns.  Then click the little red arrow and select the option to save the script to the clipboard or to a script window.  Use that script in place of what you have, and substitute the variables from the new window.