- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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));
));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: 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));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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));
));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to Write Conditional Change Expressions?
I can't believe that's the reason, learning, thanks.