Hi guys,
Attached is an example of a data set I'm working with. Its 1 weeks worth of data from 2 sensors. I'm trying to write a JSL script to take this data and by sensor average the first 24 hours of data, the last 6 hours of data, and substract the two, finally summarising the difference in a summary table, by sensor. Does anyone have any ideas?
try this
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Group",
Character,
formula(
If(
:Timestamp < Col Minimum( :Timestamp, :Sensor Number ) + 24 * 60 * 60, "First",
:Timestamp > Col Maximum( :Timestamp, :Sensor Number ) - 6 * 60 * 60, "Last"
)
)
);
dtsumm = dt << Summary(
Group( :Sensor Number ),
Mean( :DataValue ),
Subgroup( :Group ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
dtsumm << New Column( "Delta", formula( :name( "DataValue, First" ) - :name( "DataValue, Last" ) ) );