Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Lets say I have a large data set - with data collected every 15 seconds - 00:00:15, 00:00:30
I also have timestamps number 1,2, etc corresponding with each timestamp
1 - 00:15
2- 00: 30 , etc
I need to sub-sample to every 20th sample, using a button and I cannot figure out the what to put under 'Value' within Button > actions > Togglefield selection ?
There has to be some formula using mod that should get me what I need.
Thank you for your help !!
I put a hacky - '= '(1|21|41|61|81|101|121|141|161|181|201|221|241|261|281|301|321|341|361|381|401|421|441|461|481|501|521|541|561|581|601)' in the value box, to take in every 20th sample
But there has to be a more elegant way
My gut approach would be to off-load this to a counter in the script. That'll be far more maintainable and more performant.
Let's take a table which I mocked up:
[table]:
LOAD
RowNo() AS [Hour]
AutoGenerate 24;
LEFT JOIN([table])
LOAD
RowNo() AS [Minute]
AUTOGENERATE 60;
LEFT JOIN([table])
LOAD
RowNo() AS [Second]
AUTOGENERATE 60;
RENAME TABLE [table] TO [tmp];
[table]:
NoConcatenate
LOAD
RowNo() AS [id],
*
RESIDENT [tmp];
DROP TABLE [tmp];
From there, we can build a counter like so:
[table]:
NoConcatenate
LOAD
*,
if(Mod(Frac(([id]-1)/20),1)=0 OR [id]=1,1,0) AS [Counter];
LOAD
[id],
[Hour],
[Minute],
[Second]
RESIDENT [tmp];
DROP TABLE [tmp];
To walk through the counter,