如何在 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;
);
);自動化和腳本編寫蘋果系統回覆:如何在 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 );