JSL에서 조건이 주어진 행을 어떻게 삭제할 수 있습니까?안녕하세요. 저는 JSL 초보자이지만 VBA 및 Python에 대한 스크립팅 경험이 있습니다.
'purification_run'과 'parent_purification_runs'라는 두 개의 열이 있는 테이블이 있습니다. 'parent_purification_runs' 필드에 포함된 'purification_run' 필드가 있는 각 행을 삭제하고 싶습니다. 이를 수행하기 위해 다음 JSL 스크립트를 작성했는데 실행되지만 의도한 삭제를 수행하지는 않습니다. 누군가 나를 올바른 길로 인도하도록 도와줄 수 있나요? 감사해요!
// Get handles to the columns
purificationRunCol = Column("purification_run");
parentPurificationRunsCol = Column("parent_purification_runs");
// Get the list of all unique parent_purification_runs values
allParentPurificationRuns = parentPurificationRunsCol << Get Values;
// Iterate through each row
For Each Row(
// Get the purification_run value for the current row
currentPurificationRun = purificationRunCol << Get As String;
// Check if the purification_run is present in the list of parent_purification_runs
If(Contains(allParentPurificationRuns, currentPurificationRun),
// Delete the row if the condition is true
Current Data Table() << Delete Rows;
);
);자동화 및 스크립팅맥 OSRe: JSL에서 조건이 주어진 행을 어떻게 삭제할 수 있나요?이는 문제를 처리하는 한 가지 방법입니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Get the list of all parent_purification_runs values
allParentPurificationRuns = :parent_purification_runs << get values;
For Each Row(
If( Contains( allParentPurificationRuns, :purification_run ),
dt << Select Rows( Row() )
)
);
Try( dt << delete rows );