cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

remove filter using script

I have used script to apply filters in order to run frequencies on the dependent data, but haven't figured out how to remove all filters using script -- what are my options?

For example, here's my applying filter script:

Current Data Table() << Data Filter(
Add Filter(
columns( :key ),
Where( :key == {1, 3, 4, 5, 6, 888, 999} ),
Display( :admit.type, Size( 204, 140 ), List Display )
),
Mode( Show( 1 ), Include( 1 ) )
);
Distribution(
Nominal Distribution( Column( :admit.type.other ) ),
);


After I've run this, what script do I use in order to remove the filter?

Thank you!
5 REPLIES 5

Re: remove filter using script

it just came to me:

Current Data Table() << Clear Row States;
khill
Level I

Re: remove filter using script

I see this resets the row states in the data table, but I can't see how to add new filters to the existing fillter.

Simply running a new Add Filter doesn't seem to work, I must be missing something.

My objective is to apply one filter and create a subset for charting. Then clear the existing filter, apply a different filter and create a second subset.
mpb
mpb
Level VII

Re: remove filter using script

Here's an example that might help. I still cannot make the filter window go away after I'm done via scripting. Must be a way though. The following script assumes that the Fitness data is current.

Re: remove filter using script

I am having the same issue as Khill, I am trying to run the same contingency analysis for many different year combinations.

Here is the script that I am working on. The script runs well for the first year combination (2006, 2007). Then when I clear the selected rows and try filtering again for the next year combination (2006,2008), the filter doesn't get set, and I get a contingency analysis for all the years of data. I think I am missing something basic.

Please help, I am new to JMP and scripting, but I am enjoying the puzzle.


dt = Open("D:\T_drive\M03-SISP2-Mon\2010-SISP2-GridMon\ZPP\S_sox_0607080910_Merge.jmp")
<< Data Filter(
Location( {849, 180} ),
Add Filter( columns( :Year_ ), Where( :Year_ == {2006, 2007} ) ),
Mode( Include( 1 ) )
);

Contingency(
Y( :LT5m ),
X( :Year_ ),
Contingency Table(
Count( 1 ),
Total %( 1 ),
Col %( 1 ),
Row %( 1 ),
Expected( 0 ),
Deviation( 0 ),
Cell Chi Square( 0 ),
Col Cum( 0 ),
Col Cum %( 0 ),
Row Cum( 0 ),
Row Cum %( 0 )
)
);

dt <
Current Data Table() << Data Filter(
Location( {849, 180} ),
Add Filter( columns( :Year_ ), Where( :Year_ == {2006, 2008} ) ),
Mode( Include( 1 ) )
);

Contingency(
Y( :LT5m ),
X( :Year_ ),
Contingency Table(
Count( 1 ),
Total %( 1 ),
Col %( 1 ),
Row %( 1 ),
Expected( 0 ),
Deviation( 0 ),
Cell Chi Square( 0 ),
Col Cum( 0 ),
Col Cum %( 0 ),
Row Cum( 0 ),
Row Cum %( 0 )
)
);

dt <
Current Data Table() << Data Filter(
Location( {849, 180} ),
Add Filter( columns( :Year_ ), Where( :Year_ == {2006, 2009} ) ),
Mode( Include( 1 ) )
);

Contingency(
Y( :LT5m ),
X( :Year_ ),
Contingency Table(
Count( 1 ),
Total %( 1 ),
Col %( 1 ),
Row %( 1 ),
Expected( 0 ),
Deviation( 0 ),
Cell Chi Square( 0 ),
Col Cum( 0 ),
Col Cum %( 0 ),
Row Cum( 0 ),
Row Cum %( 0 )
)
);
chungwei
Staff (Retired)

Re: remove filter using script

Try this -

df = Current Data Table() << Data Filter( Add Filter( columns( :age, :sex, :height ) ));

df << delete(:age);

df << delete all;

df << close window;

Recommended Articles