cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Djtjhin
Level IV

How to send messages to global data filter?

Is there a way to send messages to global filter to show different filters through scripting ? 

 

Sometimes I'd like to review/ recall several filter settings or "where clauses" that were previously saved. 

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Cities.jmp" );
obj = dt << Data Filter(conditional);
obj << Add Filter( columns( :POP ) );
obj << Add Filter( columns( :Region, :State, :City ), Where( :Region == "S" ), Where( :State == {"SC", "NC"} ) );

wait(1);

//This works
obj << clear;
obj << ( filter column( :Region, :State, :City )<< Where( :Region == "S" ) );

//Unable to work once multiple clauses are perscribed
obj << clear;
obj << ( filter column( :Region, :State, :City )<< Where( :Region == "S" & State == "LA") );

Appreciate the help!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to send messages to global data filter?

Data Filter where clauses cannot be combined (or changed in many other ways), because the expression is not executed, it is parsed to set the state of the each filter item.  If you separate the state into two commands, it should work as expected:

 

obj << clear;
obj << ( filter column( :Region ) << Where( :Region == "S" ) );
obj << ( filter column( :State ) << Where( :State == "LA") );

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How to send messages to global data filter?

Could it be as simple as adding the missing ":" in front of 

State == "LA"
Jim
jthi
Super User

Re: How to send messages to global data filter?

You might have to divide it into two separate Wheres (no idea why).

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");
obj = dt << Data Filter(conditional);
obj << Add Filter(columns(:POP));
obj << Add Filter(columns(:Region, :State, :City), Where(:Region == "S"), Where(:State == {"SC", "NC"}));

Wait(1);

obj << clear;
obj << (filter column(:Region, :State, :City) << Where(:Region == "S"));

obj << clear;
obj << (filter column(:Region) << Where(:Region == "S"));
obj << (filter column(:State) << Where(:State == "LA"));
-Jarmo

Re: How to send messages to global data filter?

Data Filter where clauses cannot be combined (or changed in many other ways), because the expression is not executed, it is parsed to set the state of the each filter item.  If you separate the state into two commands, it should work as expected:

 

obj << clear;
obj << ( filter column( :Region ) << Where( :Region == "S" ) );
obj << ( filter column( :State ) << Where( :State == "LA") );
Djtjhin
Level IV

Re: How to send messages to global data filter?

Thanks @danschikore. I was hoping for a more robust functionality but seems like this is the limitation that I have to work around.