Descending and ascending columns

Does the sort function work in tables for anyone else or is there something i have to do to get it to sort my data the way I want it to.

So I want my data to be showing the most recent values at the top of my table but for some reason when I click the sort function it doesnt change anything.

Here’s this for an example

I am getting my data to show on the table through an expression so using a script to run a query will not work in this case.

I did see this sort dataset function but it didn’t work when tried it.

You could add a script transform to sort your dataset.

Your example does look sorted though, only it’s in ascending order. Clicking one more time on the column header should sort it in descending order.

I know what you mean by clicking on the header and changing it to descending order. The problem is that I would have to click that every time the project is open and although it seems like a small problem, it can get annoying very quickly

Then adding an expression to the binding with that line should do what you want:

sortDataset({value}, "timestamp", false)

where I was going wrong with that function is that I was not sure what the value should be.

Did you figure it out ?

You need to add a transform to that binding, not put the expression directly there.
Then, {value} is the return of the query. It is NOT a placeholder, you need to actually put {value} in the expression.

Is this what you mean?

Yes, except you need to remove the script transform and put an expression transform instead, then move the sortDataset line from the upper part to the transform.

The first part is the actual tag history binding. It will return the dataset you query (which doesn’t work here because the expression you gave it is not valid).
Then, when you add a transform, the result from the previous block is passed as input to the transform under the name value.
So, you first query the dataset exactly as you did before, add a transform which receives the dataset, and sort it there.

Got it. That works perfectly. Is there a reason that column property doesn’t do the same thing?

I think it can, but I don’t have any means of trying it right now so I don’t want to give you misleading information…

Just thought of something:
Can you try putting your designer in preview mode, clicking the header until it’s sorted the way you want, then exit preview mode and save your project ?

this works for some things, maybe table sorting is one of them.