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 );<BR />dtex = Open( "$SAMPLE_DATA/Arrhythmia.jmp" );<BR /><BR /><BR />// case with filter
filt = "interval";
eval(eval expr(
New Window( "Filter Col Selector if filter option given", <<MODAL> FILTER SELECTION IS GONE, not desired result
filt = "";
eval(eval expr(
New Window( "Filter Col Selector if no option", <<MODAL></MODAL><BR />// case with no option --> FILTER SELECTION stays, but how to make this dynamically based on the 'filt' value?<BR />filt = "";<BR />eval(eval expr(<BR />New Window( "Filter Col Selector if no option", <<MODAL></MODAL>));<BR /><BR />// attempt to create with substitute do not work- cant use comma in expr to make multiple to insert...<BR />testexpr = expr(new window("test", <<MODAL></MODAL> if(filter != "",<BR />_OPTIONS_ = eval expr(width(400), nlines(35), <<NAME contains=""></NAME>,<BR />_OPTIONS_ = expr(width(400), nlines(35), <<CONTINUOUS></CONTINUOUS>);<BR /><SPAN> substitude into(testexpr , expr(_OPTIONS_), name expr(_OPTIONS_));</SPAN><BR />
</MODAL>
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
Automation and ScriptingRe: 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
);
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
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);
);