cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
KST-CPT
Level II

Modify summary table

I am trying to modify a summary table.  

-The table has been ordered by Sub_name, Substrate_ID and Date in that order.

-I want to search the table and if a Sub_name is a duplicate, a Substrate ID is a duplicate and the dates are within 1 day, then combine those rows.

     -these values are ones that ran through midnight, so their dates are different, which causes them to be on seperate lines.

 

I tried the following code:

 

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,
);
);

 

 

Thanks for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Modify summary table

I think you can solve your issue very simply by using the Summary Platform for a second time

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 )
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Modify summary table

I think you can solve your issue very simply by using the Summary Platform for a second time

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 )
);
Jim