我正在尝试修改汇总表。
- 该表已按 Sub_name、Substrate_ID 和 Date 的顺序排序。
-我想搜索表格,如果 Sub_name 重复,Substrate ID 重复并且日期在 1 天内,然后合并这些行。
- 这些值是贯穿午夜的值,因此它们的日期不同,这导致它们位于不同的行上。
我尝试了以下代码:
debug = RTDT << Summary(Group( :Sub_name, :Substrate_ID, :Date ),
Mean( :Runtime ),
Freq( "None" ),
Weight( "None" ),
);
debug << Sort( By(:Sub_name, :Substrate_ID ), Order(Ascending), Replace Table);
EOL = Nrows(debug);
for(i=1, i < (EOL), i++, Formula(
if((debug:Substrate_ID[i+1] == debug:Substrate_ID[i]) &
(debug:Sub_name[i+1] == debug:Sub_name[i]) &
((debug:Date[i+1] - debug:Date[i]) == 86400),
NewCount = :N Rows[i]+:N Rows[i+1];
:N Rows[i+1] = New Count;
NewTime = column(debug|"Mean(Runtime)")[i] + column(debug|"Mean(Runtime)")[i+1];
column(debug|"Mean(Runtime)")[i+1] = NewTime;
debug << slect row(i) << delete row,
);
);
谢谢你的帮助。
我认为您可以通过第二次使用摘要平台非常简单地解决您的问题
Names Default To Here( 1 );
dt = Current Data Table();
dt << Summary(
Group( :Sub_name, :Substrate_ID ),
Max( :Date ),
Sum( :N Rows ),
Sum( :Name( "Mean(Runtime)" ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);