こんにちは、
元気にしていることを願います。
これは、2 つの異なるデータ セット (「CL と仕様」と「データ セット」) から 2 つのサブセットを実行するための、非常に長く最適化されていないコードです。 データ セットのレベルに応じて選択する行を選択するテキスト ボックスがあります。
ただし、問題は、最初のデータ テーブルのサブセット ("CL and Spec" という名前のデータ セット) が実行された後、2 番目のデータ セット ("Data set" という名前) のサブセットがエラー メッセージなしで機能しないことです。 実行されるサブセットはありません。 私の理解では、サブセットを選択するデータセットを選択する方法に問題があるということです。 または、「現在のデータ テーブル」機能を正しく使用していませんでした。
これが私のコードです:
dt2 = Data Table( "CL and Spec" );
Current Data Table( dt2 );
// get unique values from the strength column
Summarize( dt2, levels = by( :Product ) );
// construct a window containing checkboxes
New Window( "Selection",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ),
V List Box(
Text Box( "Select values:" ),
here:cb = Check Box( levels ),
Spacer Box( size( 0, 20 ) ),
Button Box( "Create Subset", doSubset() )
)
)
);
// define function to perform when button is cliccked
doSubset = Function( {},
{default local},
dt2 = Current Data Table();
dt2 << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
For( i = 1, i <= N Items( selected ), i++,
rows = dt2 << select where( :Product == selected[i], current selection( "extend" ) )
);
// create a subset table
dt2 << subset( selected rows( 1 ), selected columns only( 0 ) );
dt2 << clear select;
);
// Define the control and specification limits
LSL = dt2:LSL[1];
USL = dt2:USL[1];
dt = Data Table( "Data Set" );
Current Data Table( dt );
// get unique values from the strength column
Summarize( dt, levels = by( :Strength ) );
// construct a window containing checkboxes
New Window( "Selection",
modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ),
V List Box(
Text Box( "Select values:" ),
here:cb = Check Box( levels ),
Spacer Box( size( 0, 20 ) ),
Button Box( "Create Subset", doSubset() )
)
)
);
// define function to perform when button is cliccked
doSubset = Function( {},
{default local},
dt = Data Table( "Data Set" );
Current Data Table( dt );
dt << clear select;
// get user selections
selected = here:cb << get selected;
// iterate over each of the selected values
// and select the associated rows
For( i = 1, i <= N Items( selected ), i++,
rows = dt << select where( :Strength == selected[i], current selection( "extend" ) )
);
// create a subset table
dt << subset( selected rows( 1 ), selected columns only( 0 ) );
dt << clear select;
);私の質問と問題が明確に表現されていることを願っています;)
ご協力ありがとうございました。良い一日を!
ジャン