Sorting Relation items

Hi all and thanks for your support.

I have Table A with a Text column containing IDs and a Relation column that retrieves items from Table B based on those IDs. I want to display these retrieved items from Table B in my app according to the order specified in the Text column of Table A. The order in the Text column can vary - sometimes it might be “1,2,3”, other times “3,1,2”, and so on.

Currently, when I access the Relation column in my app, I can only sort the items based on their individual properties. This doesn’t allow me to maintain the custom order I’ve specified in the Text column of Table A.

Does anyone have any advice or suggestions for a workaround to maintain the order specified in the Text column when displaying items from Table B in my app?

thanks
Yan

Try replacing your relation column with a Query column. This allows you to specify a column to sort by.

thanks

please see attached

i want to sort my relation items based (Table B) on the sub_ids columns (Table A)
when trying to sort my only option is from the relation items properties (Table B) and not from my table where the sub_ids columns is (table A)

thanks Yan

To clarify the ultimate objective: I’m aiming to implement a customized sorting system for items based on their IDs. This system should allow for different sorting orders for different users. For instance:

  • User A to view the items in the sequence 1, 2, 3
  • User B, on the other hand, to see the same items arranged as 3, 1, 2

This personalized ordering capability is the core functionality I’m trying to achieve in my app.

So users can type in the order they want to view the item?

  • If you have an action before going to a details screen of table A, then set the rowID of that row to a column in your Users table, in the signed-in user’s row, let’s call it “Viewing Table A record”.
  • Go to table B, add a template column and reference the “Viewing Table A record” value in user profiles table.
  • Create a relation using that value back to the Users table.
  • Use a lookup column to get the “order” text column to table B.
  • Split them using a split text column to get an array.
  • Use a “find element index” column to find the index of each record, in the array.
  • Use the relation you mentioned to display Table B records, sort by the index you get above.