选择不满足条件的地方我每天都在运行一个脚本来确定哪些部分发生了故障。我们有一天没有任何零件失败,并且由于我选择了条件不是(“失败”)的地方,它抓住了所有通过的零件并将它们输出到下一个表。我如何编写它以便如果没有部件失败,下一个表格应该是空白的?
例子:
Data Table ("Parts")<< select where (:PassOrFail == "Fail");
Data Table ("Parts")<< subset (Output Table ("Fails", selected rows (1),selected columns(0)));
由于我的 PassOrFail 列中没有“Fail”,因此输出表“Fails”只是原始表“Parts”的副本
数据表脚本编写回复:选择不满足条件的位置使用获取行而不是选择哪里 :
fail_rows = Data Table( "Parts" ) << get rows where( :PassOrFail == "Fail" );
if (nrows(fail_rows) > 0,
Data Table( "Parts" ) << subset(rows(fail_rows), selected columns( 0 ),
Output Table( "Fails")
);
);