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