How to Write Conditional Change Expressions?//case1
x={"a01","b02","c003"};
dt << select where(:name=="a01"|:name=="b02"|:name=="c003");
//case2
x={"a01","b02","c003","e03"};
dt << select where(:name=="a01"|:name=="b02"|:name=="c003"|:name=="e03");
//case3
x={"a01"};
dt << select where(:name=="a01")I have a question: as in the three cases of the code below, I now have a list x that changes, so the code for the selection condition also changes, how can I write a piece of code with an expression that takes care of all the x's that change.
macOSRe: How to Write Conditional Change Expressions?You could use Contains() instead of Or()
Names Default To Here(1);
x = {"a01", "b02", "c003"};
dt << select where(:name == "a01" | :name == "b02" | :name == "c003");
// to
dt << select where(Contains(x, :name));
Re: How to Write Conditional Change Expressions?Thank you, but the filter where in the tablebox only works like this.For example: tablebox << filter where(contains(x,colname), will report an error
Re: How to Write Conditional Change Expressions?Few questions:
- Where are you getting the x list?
- What are you trying to filter?
- What is triggering the action to filter?
Re: How to Write Conditional Change Expressions?1. x from a listbox
2. the value of a column in the tablebox
3. through the listbox selected elements, automatically change the tablebox table content, because the table there is a row with a buttonbox, so still want to achieve through filterwhere
Re: How to Write Conditional Change Expressions?Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
ot=dt<<GET as="" report="">13 );
)
)
),
Border Box( Left( 10 ), Right( 10 ), Top( 10 ), Bottom( 10 ), Sides( 0 ),
Panel Box( "Step 2",
Button Box( "taller",
ot << reset filter;
ot << filter where( Height>50 );
)
)
)
)
)
),
Outline Box( "Third",
hlb = Border Box( Left( 10 ), Right( 10 ), Top( 10 ), Bottom( 10 ), Sides( 0 ) )
)
)
;
bblist = Expr(
Col Box( "Open Graph" )
);
For( i = 1, i <= N Items( x ), i++,
Insert Into(
bblist,
Button Box( dt:name[i],
<<SETFUNCTION></SETFUNCTION></GET>
Re: How to Write Conditional Change Expressions?You might have to evaluate the variable
Names Default To Here(1);
New Window("Mountains",
tb = Table Box(
String Col Box("Mountain", {"K2", "Delphi", "Kilimanjaro", "Grand Teton"}),
Number Col Box("Elevation (meters)", {8611, 681, 5895, 4199}),
Plot Col Box("", {8611, 681, 5895, 4199})
)
);
wait(1);
l = {"K2", "Delphi"};
Eval(EvalExpr(
tb << Filter Where(Contains(Expr(l), Mountain));
));
Re: How to Write Conditional Change Expressions?I can't believe that's the reason, learning, thanks.