如何編寫條件變化表達式?//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));
));
回复:如何編寫條件更改表達式?我不敢相信這就是原因,學習,謝謝。