問題
假設您的數據表選擇了一組行。現在,您要從該選擇中選擇滿足附加條件的行。
解決方案
這選擇哪裡()數據表對象的消息提供一個選項,允許您指定從當前選擇中進行選擇。以下示例演示如何使用 Current Selection() 選項將新選擇限制為僅當前選定的行。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
/* Establish the original row selection of students under 14 years old */
dt << Select Where( :age < 14 );
Wait( 1 ); //For demonstration purposes
/* Of the students less than 14, select students who are also above 5ft in height */
dt << Select Where(
:height > 60,
Current Selection( "restrict" )
);
討論
Select Where() 的 Current Selection() 選項具有三個選項:嚴格,延長, 和清除.上面的例子演示了使用嚴格.這延長參數允許您在不影響原始選定行的情況下選擇其他行。這清除參數在進行新選擇之前取消選擇所有行。此行為與未在 Select Where() 中指定 Current Selection() 選項相同。
更多使用 Select Where() 的示例可以在選擇行JMP 腳本指南的部分。也可以看看
根據多個條件選擇行
選擇與列表中的任何值匹配的行