pass_fail 열을 얻고 싶습니다. @txnelson 스크립트로 만들었습니다.
하지만, 티 많은 열 중 하나라도 중간에 사양이 없으면 스크립트가 작동하지 않습니다.
어떻게 고칠 수 있습니까?
Names Default To Here( 1 );
dtOrig = current data table();
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 );
감사해야겠어요 @Byron_JMP 응답하기 위해.나는 이 토론에 답을 하려고 했는데, 그 전에 더 오래된 페이지로 넘어가서 기억에서 사라졌습니다.Byron의 응답은 토론을 내 NameSpace로 되돌려 놓았습니다.
문제를 해결하기 위해 해야 할 일은 주어진 열에 관련 사양 제한이 있는지 확인하는 것뿐이라고 생각합니다.사양 제한이 없으면 해당 열을 처리하지 마십시오.다음은 원하는 작업을 수행할 수 있는 다소 비밀스러운 제안된 변경 사항입니다.문제의 기본은 사양 제한이 발견될 때만 코드를 처리하기 위해 If() 함수를 사용하는 것입니다. 이것은 현재 사양을 대체합니다 = 코드 행
clear symbols(specs);
specs = Column( dt, colNamesList[theCol] ) << get property( "spec limits" );
If(isEmpty(specs)==0,
<ALL of="" the="" code="" to="" the="" end="" of="" the="" for="" loop=""></ALL>
저처럼 심플한게 좋아요!
그래서 단순화했습니다(중첩 필요 없음).
If( :Data >= 42, "Too High", :Data < 7, "Too Low", "Just Right")
TXnelson은 정말 멋진 코드를 작성합니다!
그러나 다음과 같은 간단한 솔루션을 찾고 있을 수 있습니다.
If( :Data >= 42,"Too High",If( :Data < 7,"Too Low","Just Right"))

데이터 값이 42 이상이면 수식이 "너무 높음"을 반환하고 데이터가 7보다 작으면 "너무 낮음"을 반환하고 너무 높거나 낮지 않은 경우 중첩된 If 문일 뿐입니다. 수식은 "맞음"을 반환합니다.
수식 편집기에 수식을 붙여넣은 다음 올바른 열 이름, 값 및 메시지로 대체할 수 있습니다. (열 이름을 마우스 오른쪽 버튼으로 클릭하고 수식을 클릭한 다음 위의 JSL을 대화 상자에 붙여넣습니다.)
건배,
비