데이터 테이블 선택 문제안녕하십니까,
잘 지내고 계시길 바랍니다.
이것은 두 개의 서로 다른 데이터 세트("CL 및 사양" 및 "데이터 세트")에서 두 개의 하위 집합을 수행하는 매우 길고 최적화되지 않은 코드입니다. 데이터 세트의 수준에 따라 선택할 행을 선택하는 텍스트 상자가 있습니다.
그러나 문제는 첫 번째 데이터 테이블의 하위 집합("CL 및 Spec"이라는 데이터 세트)이 수행된 후 두 번째 데이터 세트의 하위 집합("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 및 사양" 데이터 세트를 로드하고, 텍스트 상자를 열고, "CL 및 사양" 데이터 세트의 행을 하위 집합으로 만들고, 매개 변수 "LSL" 및 "USL"을 LSL에 저장하는 것입니다. 및 USL 변수. 그러면 "CL 및 사양" 데이터 세트가 더 이상 사용되지 않습니다.
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>
그런 다음 코드의 두 번째 부분은 "데이터 세트" 데이터 세트를 로드하고, 텍스트 상자를 열고, "데이터 세트" 데이터 세트의 행을 하위 집합으로 만드는 것입니다.
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;
);그러나 두 번째 데이터가 로드되지 않았거나 행의 하위 집합이 없습니다...
당신의 도움을 주셔서 대단히 감사합니다!