如何编写条件变化表达式?//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")我有一个问题:如下面代码的三种情况,我现在有一个列表x发生变化,因此选择条件的代码也发生变化,我怎样才能编写一段带有照顾所有情况的表达式的代码x 是变化的。
苹果系统回复:如何编写条件更改表达式?你可以使用包含()而不是 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));
回复:如何编写条件更改表达式?谢谢,但是tablebox中的filter where只能这样用。例如: tablebox << filter where(contains(x,colname),会报错
回复:如何编写条件更改表达式?几个问题:
- 你从哪里得到 x 列表?
- 你想过滤什么?
- 是什么触发了过滤操作?
回复:如何编写条件更改表达式?1. x 来自列表框
2. tablebox中某列的值
3.通过listbox选中元素,自动改变tablebox表格内容,因为table中有一行带有buttonbox,所以还是想通过filterwhere来实现
回复:如何编写条件更改表达式?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>
回复:如何编写条件更改表达式?您可能必须评估变量
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));
));
回复:如何编写条件更改表达式?我不敢相信这就是原因,学习,谢谢。