cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
jetpeach
Level III

creating Filter Col Selector with options from expressions (dynamically)

My goal is to create a Filter Col Selector in a modal window that applies a default "name contains" filter if one is given to the function. However, in the case where input to the function has a blank filter, it leaves open the filterbox so user is ready to input a filter.

 

Here is example result of desired output if input was blank, vs "interval"

Names Default To Here( 1 );
dtex = Open( "$SAMPLE_DATA/Arrhythmia.jmp" );


// case with filter filt = "interval"; eval(eval expr( New Window( "Filter Col Selector if filter option given", <<modal, Filter Col Selector( dtex, << name contains(expr(filt)), width( 250 ), nlines(30) ) ); )); // case with no option --> FILTER SELECTION IS GONE, not desired result filt = ""; eval(eval expr( New Window( "Filter Col Selector if no option", <<modal, Filter Col Selector( dtex, << name contains(expr(filt)), width( 250 ), nlines(30) ) ); ));

// case with no option --> FILTER SELECTION stays, but how to make this dynamically based on the 'filt' value?
filt = "";
eval(eval expr(
New Window( "Filter Col Selector if no option", <<modal, Filter Col Selector( dtex, width( 250 ), nlines(30) ) );
));

// attempt to create with substitute do not work- cant use comma in expr to make multiple to insert...
testexpr = expr(new window("test", <<Modal, Filter Col Selector( current data table(), _OPTIONS_)););
if(filter != "",
_OPTIONS_ = eval expr(width(400), nlines(35), <<name contains(expr(default_list_filter)), <<continuous(0), <<Clear selection );
,
_OPTIONS_ = expr(width(400), nlines(35), <<continuous(0), <<Clear selection);
);
substitude into(testexpr , expr(_OPTIONS_), name expr(_OPTIONS_));

 

So I started down a rabbit hole of making the "name contains" into an expression that would optionally be added only to the case where a filter is applies - any ideas though on how to easily due this? I had substitute into the expression, but  this stalled when i needed to make a list instead...

 

Thanks,

--Peach

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: creating Filter Col Selector with options from expressions (dynamically)

Are you looking for something like this? There is an ifbox which is set to 0 by default in filter col box, you can set it to 1 to make the search box visible. Also you can just send send the message << Name Contains to your filter col box instead of building it inside (usually easier to manage this way).

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Arrhythmia.jmp");// case with filter
filt = "interval";

fcs = Filter Col Selector(dt, , width(250), nlines(30));
Eval(EvalExpr(fcs << Name contains(Expr(filt))));

fcs[IfBox(1)] << Set(1);

nw = New Window("Filter Col Selector Example", << modal,
	fcs
);

-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: creating Filter Col Selector with options from expressions (dynamically)

Are you looking for something like this? There is an ifbox which is set to 0 by default in filter col box, you can set it to 1 to make the search box visible. Also you can just send send the message << Name Contains to your filter col box instead of building it inside (usually easier to manage this way).

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Arrhythmia.jmp");// case with filter
filt = "interval";

fcs = Filter Col Selector(dt, , width(250), nlines(30));
Eval(EvalExpr(fcs << Name contains(Expr(filt))));

fcs[IfBox(1)] << Set(1);

nw = New Window("Filter Col Selector Example", << modal,
	fcs
);

-Jarmo
jetpeach
Level III

Re: creating Filter Col Selector with options from expressions (dynamically)

thanks a bunch! I had tried to send a message exactly as you mentioned, but thought because I had a model window that I couldn't actually do that.

however, i see you built the filter col selector first, then create the modal window last - simple, i just hadn't thought of that. perfect, thank you

jthi
Super User

Re: creating Filter Col Selector with options from expressions (dynamically)

You can either build it before (I would do this) but you can also send the messages inside the new window and it should work

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Arrhythmia.jmp");// case with filter
filt = "interval";

nw = New Window("Filter Col Selector Example", << modal,
	fcs = Filter Col Selector(dt, , width(250), nlines(30)),
	
	Eval(EvalExpr(fcs << Name contains(Expr(filt))));
	fcs[IfBox(1)] << Set(1);
);

 

-Jarmo

Recommended Articles