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"} )
);