BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
martindemel

Staff

Joined:

Jul 10, 2014

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

 

 

 

2 Comments
Community Trekker

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

 

 

Staff

Hi gzmorgan0,

thanks for sharing this alternative!