Subscribe Bookmark RSS Feed

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

jason_paquette

Community Trekker

Joined:

Jan 26, 2015

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
Solution

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 ) )

);

8 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

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
jason_paquette

Community Trekker

Joined:

Jan 26, 2015

Thank you for posting this.

Exactly what I was looking for!

hardner

Community Trekker

Joined:

Nov 13, 2012

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

Joined:

Jul 13, 2011

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
Solution

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

Joined:

Jun 23, 2011

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

Joined:

Jun 23, 2011

what version of JMP are you running ?

ron_horne

Super User

Joined:

Jun 23, 2011

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!