我正在嘗試修改匯總表。
- 該表已按 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 )
);