Subscribe Bookmark RSS Feed

Data Table Filter Window Not Staying Hidden on Repeated Usage of JSL

terapin

Community Trekker

Joined:

Jun 23, 2011

I'm running into an interesting problem with some JSL code used to invoke the Data Filter.  With the following code the specified data is selected and the Data Filter window isn't shown as specified in JSL.  However, if the code is run a 2nd time the Data Filter window is displayed and the specified data isn't selected.  Once the Data Filter is manually closed and the JSL run again, the specified data is selected again.  If the JSL code is run repeatedly, this alternating behavior continues each time.  Any ideas why this might be occuring and how I can force the Data Filter to run each time without opening the DF window?  Thanks.

 

 

Clear Log();

Names Default to Here ( 1 );

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

dt << Select Excluded;
dt << Clear Row States;


df = dt << Data Filter(
Show Window( 0 ),
Add Filter(
Columns( :age, :sex, :height ),
Where( :age == {13, 14, 15} ),
Where( :sex == "M" ),
Where( :height >= 50 & :height <= 65 )
)
);

1 ACCEPTED SOLUTION

Accepted Solutions
terapin

Community Trekker

Joined:

Jun 23, 2011

Solution

See official reponse from JMP Technical Support below regarding the Data Filter behavior.

 

Thank you for contacting JMP Technical Support!

 

If you run your script once and look at the Window List on the Home Window, you will notice that the Data Filter does show up as an invisible window as shown in the screenshot below.

 

 

One thing to note is that you cannot have more than one Data Filter for each data table. If you were to create a Data Filter based on age via scripting and then try to create another Data Filter based on gender, the gender Data Filter cannot be created since one already exists for the data table.

 

In your case, since a Data Filter already exists when you run it the second time, JMP brings the existing Data Filter to the front to show you what the current data filter is and that it did not change. This serves as a signal to the user that the second Data Filter that was created did not actually do anything. This is the expected behavior in JMP.

 

In order to prevent the Data Filter from showing, you would need to close the window of the Data Filter before creating a new one. In the example below, I show how to do this using a window object reference. However, if you have the handle of the data filter (df) available, you can send a close message directly to that reference.

 

Names Default To Here( 1 );

 

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

 

dt << Select Excluded;

dt << Clear Row States;

 

// Try to close the data filter window in case one is open

Try( Window( "Data Filter for Big Class" ) << Close Window() );

 

df = dt << Data Filter(

   Show Window( 0 ),

   Add Filter(

       Columns( :age, :sex, :height ),

       Where( :age == {13, 14, 15} ),

       Where( :sex == "M" ),

       Where( :height >= 50 & :height <= 65 )

   )

);

 

I hope this information is helpful. Please let me know if you have follow-up questions, or need clarification.

 

3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

There appears to be an issue with the "Show Window(0) function.  Rather than taking the value of the element (0), it seems to be toggleing.  I would report this to the JMP folks at

support@jmp.com

Jim
terapin

Community Trekker

Joined:

Jun 23, 2011

Thanks Jim.  Good to know it wasn't something I was doing in the code. I've contacted JMP support as you suggested.

terapin

Community Trekker

Joined:

Jun 23, 2011

Solution

See official reponse from JMP Technical Support below regarding the Data Filter behavior.

 

Thank you for contacting JMP Technical Support!

 

If you run your script once and look at the Window List on the Home Window, you will notice that the Data Filter does show up as an invisible window as shown in the screenshot below.

 

 

One thing to note is that you cannot have more than one Data Filter for each data table. If you were to create a Data Filter based on age via scripting and then try to create another Data Filter based on gender, the gender Data Filter cannot be created since one already exists for the data table.

 

In your case, since a Data Filter already exists when you run it the second time, JMP brings the existing Data Filter to the front to show you what the current data filter is and that it did not change. This serves as a signal to the user that the second Data Filter that was created did not actually do anything. This is the expected behavior in JMP.

 

In order to prevent the Data Filter from showing, you would need to close the window of the Data Filter before creating a new one. In the example below, I show how to do this using a window object reference. However, if you have the handle of the data filter (df) available, you can send a close message directly to that reference.

 

Names Default To Here( 1 );

 

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

 

dt << Select Excluded;

dt << Clear Row States;

 

// Try to close the data filter window in case one is open

Try( Window( "Data Filter for Big Class" ) << Close Window() );

 

df = dt << Data Filter(

   Show Window( 0 ),

   Add Filter(

       Columns( :age, :sex, :height ),

       Where( :age == {13, 14, 15} ),

       Where( :sex == "M" ),

       Where( :height >= 50 & :height <= 65 )

   )

);

 

I hope this information is helpful. Please let me know if you have follow-up questions, or need clarification.