Sort Dataset by Timestamp

I have a dataset that has 2 columns, the first is the timestamp and the second is a value column for a particular tag.
I want to sort that dataset to return a dataset of values for one hour.
Can anyone help?

Thanks in advance!

Have you seen the documentation for system.dataset.sort?

I did look at that; however, I was not sure if it was possible to capture just one hour out of the current dataset. the current dataset hold a days worth of data for a particular tag.

I can sort out and get just a single column and sort it is ascending or descending, but as far as getting what I want I am still stumped

Sort the data first, then determine what rows to keep and apply the opposite operation via
If you’ve got a consistent sample rate, you can even just do the math; eg keep the first 60 records and remove the rest.

If you use the system.dataset.sort on a week or two weeks worth of data and try to sort on the date (timestamp) in descending order, will it actual sort based off Monday through Friday? It does not seem to work that way for me, unless I am doing something wrong here.

Well, descending would give Friday down to Monday, is that what you’re seeing?

1 Like