
안녕하세요 질문이 하나 있습니다.
사양이 켜져 있을 때 실패 이름을 쓰고 싶을 때 스크립트를 작성하려면 어떻게 해야 하나요? 위의 이미지처럼.
첨부파일(샘플만)을 참고하시기 바랍니다.
내가 쓰는 실제 데이터에는 1000개의 열이 있습니다.
감사
다음은 각 열의 열 속성에서 사양 제한을 사용하여 각 행을 테스트하는 방법입니다.테스트에 사용된 방법은 각 열에 Range Check를 적용하는 것입니다.이것은 하나의 작업으로 열의 모든 데이터를 처리하는 매우 효율적인 방법이기 때문에 사용됩니다.처리하는 열의 수를 감안할 때 이 방법은 각 셀을 테스트하는 것보다 더 효율적이어야 합니다.스크립트에서 나는 샘플 데이터 폴더의 반도체 데이터 테이블을 사용합니다.128개의 모든 측정 열에 대해 모든 사양 제한이 설정되어 있습니다.
Names Default To Here( 1 );
dtOrig = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
colNamesList = dtOrig << get column names( continuous, string );
// Create a work table of just the continuous columns
dt = dtOrig << subset( columns( colNamesList ), selected rows( 0 ) );
// Loop across all of the columns and apply a Range Check to eliminate
// all data outside of the upper and lower spec limits
For( theCol = 1, theCol <= N Items( colNamesList ), theCol++,
specs = Column( dt, colNamesList[theCol] ) << get property( "spec limits" );
Eval(
Substitute(
Expr(
Column( dt, colNamesList[theCol] ) << set property(
"Range Check",
(LELE( __LSL__, __USL__ ))
)
),
Expr( __LSL__ ), specs["LSL"],
Expr( __USL__ ), specs["USL"]
)
);
// Now convert the column to numeric
Column( dt, colNamesList[theCol] ) << data type( character );
// Now find all cells where values were eliminated
dt << select where( As Column( dt, colNamesList[theCol] ) == "" );
// If non passing rows were found, process the column to change the passing rows to
// a blank, and non passing to the name of the column
If( N Rows( dt << get selected rows ) > 0,
// Now set all eliminated cells to have the value of the name of the column
Column( dt, colNamesList[theCol] )[dt << get selected rows] = Column( dt, colNamesList[theCol] ) <<
get name;
// Invert the row selection, to select all rows where values passed and set them to a blank
dt << invert row selection;
Column( dt, colNamesList[theCol] )[dt << get selected rows] = "";
, // else set all
Column( dt, colNamesList[theCol] )[Index( 1, N Rows( dt ) )] = ""
);
);
// Now create a new column to hold the information on either that the row Passed or
// which columns failed
dt << New Column( "Pass_Fail", Character );
// Loop across all rows and set the values for the new column
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
If( Trim( Concat Items( dt[theRow, 0, ""] ) ) == "",
:Pass_Fail[theRow] = "Pass"
,
thePass_Fail = Concat Items( dt[theRow, 0], "," );
For( i = Length( thePass_Fail ), i >= 2, i--,
If( Substr( thePass_Fail, i, 1 ) == ",",
If( Substr( thePass_Fail, i - 1, 1 ) == ",",
thePass_Fail = Substr( thePass_Fail, 1, i - 1 ) || Substr( thePass_Fail, i + 1 )
)
)
);
If( Right( thePass_Fail, 1) == ",", thePass_Fail = Left( thePass_Fail, length( thePass_Fail ) - 1 ) );
:Pass_Fail[theRow] = thePass_Fail;
)
);
// Only the new column is what is needed, so delete all other columns
dt << delete columns( eval(colNamesList) );
// Add the new column to the original data table
dtOrig << Update(
With( dt )
);
// Delete the no longer needed work table
close(dt, nosave );좋아, 나는 그 추가 기능에 익숙하지 않지만 아마도 그 작성자 @txnelson 여기에서 해당 추가 기능의 정보를 통합하는 방법에 대해 이야기할 수 있습니다. 나는 당신이 찾고 있는 것을 할 수 있는 작은 예를 작성하고 7열 예제 테이블에 대해 테스트했으며 1000열 버전으로 확장할 수 있기를 바랍니다. 열과 같은 순서로 상한(UL) 목록과 하한(LL) 목록이 있다고 가정합니다. 데이터 테이블에서 열을 읽을 수 있습니다. 필요한 경우 추가 기능에서 데이터 테이블에 액세스할 위치를 모르겠습니다.
이를 구현할 수 있는 다양한 방법이 있습니다. 내가 쓴 것은 단지 하나의 방법입니다. 내가 사용한 일반 계획은 다음과 같습니다. 각 열을 해당 한도에 대해 확인하십시오. 사양을 벗어난 경우 이를 기록하는 목록에 추가합니다. 루프의 끝에서 목록이 비어 있으면 PASS를 씁니다. 그렇지 않으면 목록의 모든 항목을 연결합니다.
dt = current data table(); // Process Measurements.jmp
// I just made these up.
// Assuming they are in the same order as the column names
ul = {10.5, 13.8, 2, 5, 1.1, 0.8, 11.8};
ll = {5.5, 13.4, 0.1, 1, 0.2, 0.2, 7};
col_list = dt << get column names(String);
dt << New Column("Check", Character, Nominal); // make blank column
// note that the new column is not in col_list
For Each Row( // in current data table
failcheck = {}; // initialize empty list
For(c=1, c<=N Items(col_list), c++, // loop over columns in col_list
// check if lower than LL or higher than UL
If(column(dt,col_list[c])[] < ll[c] | column(dt,col_list[c])[] > ul[c],
// if so, add this column to the failcheck list
Insert Into(failcheck, col_list[c])
)
);
If(N Items(failcheck)==0, // is the list empty?
column(dt,"Check")[] = "PASS",
column(dt,"Check")[] = Concat Items(failcheck,", ")
);
);이게 말이 되요? 무슨 일이 일어나고 있는지 궁금한 점이 있으면 알려주세요.