Sorting on Tables (repating group)

Can someone point me in the right direction?
I have created a table (repeating group) and now want to add a sorting function to the various columns.

For example, with dates:
The table defaults to ascending order. When you click on the sorting icon, the order changes to descending, but how can I make the sorting go back to ascending by clicking on it again?

I have made a Custom State for each column and use this to change the sorting.
Skjermbilde 2024-01-26 kl. 09.45.20

I thought this would work? But the second step in the Workflow deactivate the first?

There can be several ways for achieving this functionality but this one I always prefers I-e using conditions on repeating Group …. If dropdown value is this etc etc

I have a condition on the repating group:
If *page* customstate is *x*
It works when I only have the first workflow, but the function breaks when I add the second one.

No you don’t need to add custom state . This functionality can be achieved directly….

I-e if dropdown value is _______ then set data of repeating Group as ________ . Hope you got my point ….

So in this way if you have 4 dropdown values you will have to use 4 conditions….

The sort by Change which field is all for this reason (dynamically sorting based on some field) with two custom states to the repeating group:

See the demo below:

When the names are clicked, all you need is to change custom states:

And the same for Date column (see how the name of the field is different than the label):

There is a trick in changing Descending. This is not clear what it does but it technically toggles :slight_smile:

You can also store these names in a combobox and make this all available in one single workflow if you want.

1 Like


Don’t use conditional datasources on your RG for this…

User a dynamic sort by expression, with ‘Change which field’.

1 Like


I use icons and not text. I tried to do the same as you, but I get no data in return

When I press the sorting Icon the rable gets emty…
Skjermbilde 2024-01-26 kl. 13.58.17

Can you see where I´m doing wrong?

The names of the fields in your data and the values you set to the custom state value should be exactly same. Is the name of the date Date in your database?

1 Like

As @hergin points out, the value you use must be exactly the same as the Database field name.

From your original post it looks as though your field name is Date but the value you’re using in your sort is "Date"

1 Like

Thanks! That worked :sunny:
@hergin and @adamhholmes
I owe you guys a beer :beers: :beer:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.