JSL 腳本 if 語句 then 刪除列你好,
我是 JSL 腳本的新手。 對於以下場景,如何在 JSL 腳本中編寫:
如果 A 列中的最後 10 行 <= B 列中的最後 10 行,則刪除 C 列和 E 列,否則刪除 D 列和 F 列。 A 列和 B 列中最後 10 行的值始終相同。 誰能幫忙把這個翻譯成JSL腳本嗎?

回覆:JSL 腳本 if 語句 then 刪除列如果我正確解釋您的請求,下面的簡單腳本將為您提供您想要的
Names Default To Here( 1 );
dt = Current Data Table();
// Initialize a counter
count = 0;
// Loop through the last 10 rows and count
// the number of times :A<=:B
For( i = N Rows( dt ) - 9, i <= N Rows( dt ),
i++,
If( :A[i] <= :B[i], count++ )
);
// Handle the 2 scenarios for which columns to delete
If( count == 10,
dt << delete columns( {"C", "E"} ),
dt << delete columns( {"D", "F"} )
);