cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar

Adding "Name contains" search bar to Column Dialog form in JSL.

Hello,

I was wondering if there was a straightforward way to add search capability to the Column Dialog form within JSL, similar to the functionality within the red triangles of all platform column selections.

My very basic code skeleton works but I would like to add the search bar:

Column Dialog(

y_col = Col List( "Y Variable", Max Col( 1 ) ),

x_col = Col List( "X Variable", Max Col( 1 ) ),

);

Thank you,

JP

1 ACCEPTED SOLUTION

Accepted Solutions
chungwei
Staff (Retired)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

how about the Filter Col Selector ?

This is an example from the scripting index -


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

New Window( "Filter Col Selector Example",

  fontobj = lb = Filter Col Selector( width( 250 ) )

);

View solution in original post

8 REPLIES 8
David_Burnham
Super User (Alumni)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

I'm not sure that there is an out-of-the-box method, but you can script the functionality.  Here is an example:

8878_test-search.PNG

dt = Current Data Table();

lstColNames = dt << Get Column Names(string);

New Window("Test",

     Lineup Box(NCOl(1),

       teb = Text Edit Box("",<<Hint("search string"),<<Set Script(DoSearch())),

       clb = Col List Box()

   )

);

clb << Set Items(lstColNames);

DoSearch = Function({},{Default Local},

    str = teb << Get Text;

       If (Trim(str)=="",

        dt = Current Data Table();

        lstColNames = dt << Get Column Names(string);

        clb << Set Items(lstColNames);

,

        lstColNames = clb << Get Items;

        lstMatch = {};

               For (i=1,i<=NItems(lstColNames),i++,

            colName = lstColNames[i];

                      If (Contains(colName,str),

                           InsertInto(lstMatch,colName);

            )

        );

        clb << Set Items(lstMatch);      

       )

);


-Dave

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

Thank you for posting this.

Exactly what I was looking for!

hardner
Level V

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

Cool!  But did either of you have any luck turning this into a modal window so it would really act like a dialog?  Simply making the window modal makes  entering something in the search box act like you hit the OK button on the window so you don't get to pick  your columns.

David_Burnham
Super User (Alumni)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

Whilst Column Dialog is a (deprecated) modal window, if you look at the JMP interface dialogues with a user are rarely implemented using modal windows.  If you need the window to be modal then the Set Items line immediately after the window definition needs to be placed inside an OnOpen event handler.  Responding to the enter key during a search and preventing it being treated as an OK click would need to be handled using an OnValidate handler on the window.

-Dave
chungwei
Staff (Retired)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

how about the Filter Col Selector ?

This is an example from the scripting index -


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

New Window( "Filter Col Selector Example",

  fontobj = lb = Filter Col Selector( width( 250 ) )

);

ron_horne
Super User (Alumni)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

hi Chungwei,

this filter is very useful and is available in most platforms in JMP. is there a reason it is not built-in to the Fit model dialog? it would be very useful there.

chungwei
Staff (Retired)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

what version of JMP are you running ?

ron_horne
Super User (Alumni)

Re: Adding "Name contains" search bar to Column Dialog form in JSL.

hi ChungWei

i am using jmp 11.

in JMP 12 (or any other version it is not available)

this is out of the help documentation: the fit model just doesn't have the red triangle near the list of columns

9900_pastedImage_0.png

on the other hand the fit y by x has it (and had it for many versions back)

9901_pastedImage_1.png

Thanks!