Sort descending Tag History binding by Timestamp


I like to populate perspective tables with tag history data that I want to see the latest entry first.
The best way is using script transform after history binding.
I need some idea on how to use script transform to do that.
The tag history binding return two format document and dataset. Which format is easier to manipulate on the fly by script transform?

Well, the system.dataset.sort() function would make it a one-liner. Is that easy enough?

1 Like

Hi Phil
Thanks. But what about document format which is needed json(document format)
What you think about json vs dataset? Which one has better performance?

Sounds like someone needs to do some timing experiments…

The tag history APIs natively return datasets - choosing the document format is doing post-query transformation, so I would certainly expect dataset returns to be faster. What may be slower is actually using those results in Perspective, since datasets have to be transformed a little bit to work across our property trees. Worth some testing, for sure.

1 Like

Thanks Paul,
Could you please guide me how I can sort the return json (document format)?
I also need some data manipulation on the results.