データ テーブルの選択に関する問題こんにちは、
元気にしていることを願います。
これは、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;
);私の質問と問題が明確に表現されていることを願っています;)
ご協力ありがとうございました。良い一日を!
ジャン
スクリプティングRe: データ テーブルの選択に関する問題私はあなたのテーブルを持っていませんが、これは私が同様の問題にアプローチする方法です:
Names Default to Here( 1 );
dt2 = Data Table( "CL and Spec" );
// get unique values from the strength column
levels = Associative Array( dt2:product ) << Get Keys;
// construct a window containing checkboxes
continue = 0;
New Window( "Selection",
<<MODAL></MODAL>
Re: データ テーブルの選択に関する問題実際、私の懸念は、2 つの異なるデータ セットを開き、最初のデータ セットのデータを使用してから、次のデータ セットに切り替えたいということです。
サブセットを実行する前に、「現在のデータ テーブル」機能を使用しました。
コードの最初の部分では、「CL and Spec」データ セットを読み込み、テキスト ボックスを開き、「CL and Spec」データ セットの行をサブセット化し、パラメータ「LSL」と「USL」を LSL に保存します。および USL 変数。 その後、「CL and Spec」データセットは使用されなくなります。
Names Default to Here( 1 );
dt2 = Data Table( "CL and Spec" );
// get unique values from the strength column
levels = Associative Array( dt2:product ) << Get Keys;
// construct a window containing checkboxes
continue = 0;
New Window( "Selection",
<<MODAL></MODAL>
次に、コードの 2 番目の部分では、「データ セット」データ セットを読み込み、テキスト ボックスを開き、「データ セット」データ セットの行をサブセット化します。
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;
);ただし、2番目のデータがロードされていないか、行のサブセットがありません...
ご助力ありがとうございます!