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
JSL:Selecting cols with Filter Col Selector and hot spot functionality Show Filter as "default"

I just came around a question from a customer which I found worth sharing to the scripting community and those who would like to become part of it

 

In any platform where you can select the columns to drag them into roles you have the option in these little red triangles (hot spots) to show a filter, which helps you to search for column names you are interested in. A very helpful feature if you have more variables than just a few!

 

Now let's imagine you want to build up an application using this column filter in your own window. You can open up the Scripting Index under Help -> Scripting Index and search for "col filter". "Filter Col Selector" will appear quite prominent in the first rows of the results list of commands. Well, that's a good start. There is even an example.  

 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "Col List Box Example",
	fontobj = lb = Filter Col Selector( width( 250 ) )
);

This results in this window:

 

 

Window_ColSelector.JPG

 

So far so good, but where is my filter???

What you should always remind are commands like Show Properties(), as they will show you in the log all options you have to apply to this object, in this case fontobj.

Show Properties(fontobj);

This will create a bunch of commands, however what you really want is one of the following three:

 

Name contains [Action] [Scripting Only] 
Name starts with [Action] [Scripting Only] 
Name ends with [Action] [Scripting Only] 


Another way to look out for commands to be used on Filter Col Selector is the Scripting Index, this time not searching, but looking into the category list and select Filter Col Selector. Then those actions appear in the middle of the Scripting Index Window.

 

So using one of these commands you'll get the filter right after creating the window and somehow set it as default for your Filter Col Selector Window:

 

fontobj << Name Contains (" ");

Please be aware that you need to at least enter a space, otherwise the filter won't appear. This will be the result:

 

 

Result_ColSelector.JPG

 

 

I hope you found this as valuable as I did or at least it reminded you to check out for what JMP provides you using Help or commands like Show Properties() or Show Tree Structure() and others.

Best,

Martin

 

 

 

Last Modified: Dec 21, 2023 1:33 PM
Comments
gzmorgan0
Super User (Alumni)

This is a simple alternative to something posted earlier.

The Filter Col Selector search box is nested within an IfBox. It can be displayed by enabling the IfBox. Thank you for sharing your solution.

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


New Window( "Filter Col Selector Example",
    fcb = Filter Col Selector( width( 250 ))
);

ib = (fcb<<Parent) << Xpath("//IfBox");
ib << set(1); //enables the IfBox

 

 

martindemel
Staff

Hi gzmorgan0,

thanks for sharing this alternative!

 

ankitgssingh
Level III

Hello 

 

Is there a way to always see only categorical column in a Filter Col Selector ? 

 

We can do this manually through JMP but is there a way to code it in JSL?

 

danschikore
Staff

Hi @ankitgssingh - each of the data type and modelling type options that you see in the menus has a corresponding JSL message.  For example you can use something like this:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "Filter Col Selector Example",
	lb = Filter Col Selector( width( 250 ), <<continuous(0), <<ordinal(0), <<nominal(1) )
);

Additional examples are shown in the Help > Scripting Index dialog.

ankitgssingh
Level III

It worked. I didn't know about the scripting Index dialog. Thank you for this tip.  @danschikore