BookmarkSubscribe
Choose Language Hide Translation Bar
sebastians
Community Trekker

save filter settings and use this settings to reset the filter

is it possible to save filter settings and use this settings to reset the filter?
minimal example:

dt=open("$sample_data/big class.jmp");
new window("test",
    ldf=dt<< Data Filter( Add Filter( columns( :sex ), Where( :sex == "F" ) ));
);
//[save the filter settings]

ldf<<clear;
//[reset the filter]

 

Thank You!

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: save filter settings and use this settings to reset the filter

The documentation, along with examples of each of the items you are working with are available in the Scripting Index.  I suggest you familiarize yourself with it.

     Help==>Scripting Index

Secondly, I believe what you really want to use, is the ability to Save and Apply Favorites.  See the Scripting Index for details and examples.  Here is an example based upon your included example

dt = Open( "$sample_data/big class.jmp" );

ldf = dt << Data Filter(
	Mode( Show( 1 ), Include( 1 ) ),
	Add Filter( columns( :sex ), Where( :sex == "F" ) )
	
);
ldf << add favorites("savedit");

Wait( 5 );
ldf<<delete all
Wait( 5 );

ldf<<apply favorites("savedit");
Jim
4 REPLIES 4
txnelson
Super User

Re: save filter settings and use this settings to reset the filter

You can save the script for the filter, and then run that script.

     txt = obj << Get Script;

Or, you can have it retrieve the Where Clause it generated

     txt = obj << get where clause;

     

Jim
sebastians
Community Trekker

Re: save filter settings and use this settings to reset the filter

Thank you Jim,
we want to reset the data filter after some data manipulations to its orginal settings. can one of the statements to do this.

dt=open("$sample_data/big class.jmp");
new window("test",
    ldf=dt<< Data Filter(    Mode( Show( 1 ), Include( 1 ) ), Add Filter( columns( :sex ),
        Where( :sex == "F" ) ));
);
txt = ldf << Get Script;
txt2 = ldf << get where clause;
ldf<<clear;

//data manipulation

//this does not work.
ldf << txt2;
ldf<< eval (txt2);
//and does not result in an error

//this does not work either.
ldf << Where( :sex == "F" );
0 Kudos
txnelson
Super User

Re: save filter settings and use this settings to reset the filter

The documentation, along with examples of each of the items you are working with are available in the Scripting Index.  I suggest you familiarize yourself with it.

     Help==>Scripting Index

Secondly, I believe what you really want to use, is the ability to Save and Apply Favorites.  See the Scripting Index for details and examples.  Here is an example based upon your included example

dt = Open( "$sample_data/big class.jmp" );

ldf = dt << Data Filter(
	Mode( Show( 1 ), Include( 1 ) ),
	Add Filter( columns( :sex ), Where( :sex == "F" ) )
	
);
ldf << add favorites("savedit");

Wait( 5 );
ldf<<delete all
Wait( 5 );

ldf<<apply favorites("savedit");
Jim
sebastians
Community Trekker

Re: save filter settings and use this settings to reset the filter

Thank you, for your answer. It worked out totally suficient.

0 Kudos