Drag and drop records to set "order" field

Use case: I have a list of records which have an “order” field (integer). This order field represents the order in which tasks should be completed. It’d be great to have a component that allows users to drag records to change the order.

Note that I know I could somewhat achieve this with a single select, then enable drag & drop, but I somehow need to ensure that all the order numbers are unique (so if I move an item from order 1 to 2, the item at number 2 should be moved to 1!).

Not sure how useful this would be for others, maybe an edge case! Note this is related to my ask for help post found here:

6 Likes

This would be super helpful, probably for a lot of use cases.
Let’s say a user creates a task list for their co-worker, but they ended up forgetting a step or the project changes along the way and they end up needing to add a task manually. Now they need to be able to move the task to the right position so that the task order makes sense.
Third party integrations are difficult since you now can’t filter any project or user specific data.

2 Likes

Not edge at all. We would love this for offers and invoices to reorder the position of line items.

1 Like

I found a possible workaround, the only problem is the execution time since it takes a while for the workflow to complete.

Add a position number field and two formula fields to your task table. The formula fields show the position of the record below, and above (Position -1 & Position +1).
You’ll also need a linked record field that links to another table. (In my case it’s the projects table which the tasks are linked to) since Noloco doesn’t have a “find record” step to find the record where the Position field matches “Below” or “Above” of the trigger record.

Now add two workflows in Noloco, one for move up, one for move down, both triggered by record action buttons (Up & Down).

Step 1: For each item in a list do…
select project collection → task collection.

Step 1a: Only continue if…
Step 1 > “Position” = Trigger fields “Above” or “Below”, & Project ID = Project ID.

Step 1b: Update a record
Collection: Task Collection
Record ID: Step 1a (for each item do…)
Field: Position
Value: Trigger record: Position.

Step 2: Update a record
Collection: Task Collection
Record ID: Trigger
Field: Position
Value: Trigger: Above or Below.

Again, sadly it takes quite a while to execute, but it might get us a little bit closer to what we need. I also tried creating the same workflow inside Airtable with a find record step instead of the “for each item in a list + filter”, but it takes far too long for Noloco to sync the data since it doesn’t know that an automation is running inside Airtable.
So the Noloco workflow displays faster, and right after the button stops loading. It just loads for a minimum of 10 seconds which can be annoying when trying to re-arrange a large amount of tasks.

1 Like

@Xaver I actually ended up doing precisely the same, should have posted the solution back here so apologies!

But yes, I came up with the same issues surrounding the time taken to update. I now actually show a little spinner whilst it’s updating as somehow that makes it feel a little quicker and less like it’s broken!

Then of course I came across another issue in regards to a record being deleted, as this throws out the number sequence. So each time a record is deleted, I look for any records where the order number is higher, then use the “move up” number for all of those.

If this could all be done in a component it’d be amazing, but at least for now it works :slight_smile:

1 Like

Thank you for pointing out the scenario of deleted records, I need to implement that.
Hopefully this will be a feature soon. The really annoying part is that the loading time varies so much. Sometimes it works within 5 seconds, sometimes 15. Not very user friendly.

I love that people have made workarounds with workflows but this really needs to be a native feature; this feature is normally useful on more than 1 collection within an app so having to manually manage multiple workflows for the same thing is a bit of a pain.

4 Likes