Dinamic ordering of rows - virtually ordering rows by clicking on up/down arrow within table view

Hello everyone,

I have the folowing question:

I am trying to make it possible to order some values dynamically.
I have a row with some names and their sequence (order) in a list, see below (f.e. in a competition where people are frequently having a certain particular position, that might change over time).

What I want to achieve is when I manually click on the up-arrow, the row should move up - when I manually click on the down-arrow the row should move down within the list. So the order no should change within the row i click on and within the row above/below.

I was thinking of having kind of virtual row with the related rows and take this way influence on the order within the related view, but do not know how to achieve it.
Does anybody has an idea what the expression should look like?

3X_2_9_29ce7eead636e0e63f4c2ea9949626b75ec3e3a5.png

Also would be great to be able to type in the new order no into a row, that the currect row with the same number gets a lower order no and all the rows beneath automatically sortet one row down (closing the gap of the order no, where the moved up row was taken away).

Thank you much for your help!

1 7 792
7 REPLIES 7

Hello,

I’m not sure whether there is a beautiful solution for it, but the first thing that comes to my mind is:

Let’s imagine I have a table called “Production cycle”. In my case everything is ordered by SEQUENCE NO column.

  1. Create an action “Change order: Sequence - 1”

  2. Create an action “Change order: Sequence + 1”

  3. Create an action “Change order: Set sequence of previous + 1”
    Referenced rows formula: SELECT(Production cycle[CYCLE ID], [SEQUENCE NO] = [_THISROW].[SEQUENCE NO]-1)

  4. Create an action “Change order: Move up”
    This is the parent action that triggers the reordering process.

5,6,7,8. (The same logic is for the “Move Down” action)

You can use a method described here to trigger the action or:

  1. Go to Data -> Columns and a virtual column for your table called “Action buttons”
  2. Go to the “Change order: Move up” action and change the appearance to:

Hi Jackson,

thank you for your quick and very detailed reply. It is a working solution.

In my case there is a little more complicated point, I didn’t mention:
Beside the order no I also have different categories (lets say, different competition).

3X_0_d_0d3c75123f7ea9e52f33ad3a9624ec88e052d364.png

It might happen, that I pull a person out of the category A into category B (what I would do manually by changing the row input.)
In this case, a person gets into another category and leaves a blank inbetween the previous and the following row.
Do you have an idea on that?

Or maybe there is a way to build it somehoq different that such gaps are closed?

Update


To hide arrows for the first and the last rows:

Step 11 For action “Change order: Move Down” Add behaviour formula:
COUNT(SELECT(Production cycle[SEQUENCE NO],[SEQUENCE NO]=[_THISROW].[SEQUENCE NO] + 1)) <> 0

If there are categories like in your case, then use this formula:
COUNT(SELECT(Production cycle[SEQUENCE NO],AND([SEQUENCE NO] = [_THISROW].[SEQUENCE NO] + 1, [Category] = [_THISROW].[Category]))) <> 0

Step 12 For action “Change order: Move Up” Add behaviour formula:
[SEQUENCE NO] > 0

Thank you very much. The solution works great.

I just have changed

Step 12 For action “Change order: Move Up” Add behaviour formula:
[SEQUENCE NO] > 0
to
[SEQUENCE NO] > 1.

Do you have an idea how to avoid gaps if I move “move” a row from one to another category?
Is it something that needs to be changed by a workflow that checks if there are any gaps of the accumulation. And if yes, it moves all the rows below the gap one up?

As well to avoid duplicated in the new category there is a automated initial value needed that is the last of the new table. Right?
How would you do that?

Thank you very much for the detailed description

Hm… I already deleted this functionality from my app, so I can’t test it. But, I think we can do something like:

Create an action “Change order: reset”
Using this action the sequence number will be set to an empty value


In the formula for SEQUENCE NUMBER just write empty brackets like this ""

Then another action “Change order: move to the end”


MAX( SELECT( Production cycle[SEQUENCE NO], [category column] = [_THISROW].[category column] ) )+1

Then, we create a Workflow:

Update event: “UPDATES_ONLY”
“If this is true” formula:
[_THISROW_BEFORE].[category column] <> [_THISROW_AFTER].[category column]

In “Do this” block, we trigger the following actions:

  1. Change order: reset
  2. Change order: move to the end

In theory it should work.

Hi Jackson,

thank you very much for the detailed description. I appreciate it very much.
Currently it is not working properly.

I will be trying to find out why and let you know when its working.

In step № 3 try changing the formula to
SELECT(Production cycle[CYCLE ID], AND([SEQUENCE NO] = [_THISROW].[SEQUENCE NO]-1, [Category] = [_THISROW].[Category]))

Top Labels in this Space