Sorting Select Options

Hi all,

I have relation column called “Included Phases” that has Phase 1, Phase 2, Phase 3, etc. This column is set to multi-select - when I double click in my row to start selecting which phases I want it’s sorted correctly:
image

good! I believe this is configurable in the column options for Relation type columns so that’s awesome.

However, if I’m a little clumsy or careless, or I need to add in a phase later on, I might accidentally select the phases in the wrong order like shown in this screenshot and the readability suffers:
image

I would then have to deselect and reselect everything in the correct order to fix the ordering. Is there a way to enforce that this can’t happen? So if I make my selections in an odd order, it still sorts itself correctly based on the intended table order?

I have found a workaround in creating another formula column and sort(thisRow.[Included Phases],true)

but then you can’t change the selections in that formula column so its just a little more convoluted than I’d like. I anticipate needing to do this a lot so a native solution would save me a lot of time.

Thanks!

Hi @Mitchell_Wells :blush: !

You can use a button to re-order your currently selected phases while keeping the field editable :blush: .

In the sample you’ll find below, you’ll see 2 buttons :

  • The blue one [Button (Index)] sorts the phases selected in thisRow.Phases in an ascending order by an Index field created in the table storing the phases.

    Its Action formula is this one:

    thisRow.ModifyRows(
      thisRow.Phases,
      thisRow.Phases.Sort(true,Phases.Index)
     )
    
  • Similarly, the purple one [Button (Alphabetical)] sorts the phases selected in thisRow.Phases in an ascending order by the Phase field (representing the name of the phases) in the table storing the phases.

    Its Action formula is this one:

    thisRow.ModifyRows(
      thisRow.Phases,
      thisRow.Phases.Sort(true,Phases.Phase)
     )
    

Both buttons are disabled if the selected phases are already sorted :blush:

I hope this helps :innocent:

3 Likes

Hi Pch,

This seems like a great work around to making sure the list stays editable. I would still hope that Coda could add a little bit of native support for this because I don’t necessarily want to set up buttons every time I run into this issue. But it is what it is I guess.

Thanks so much for your help!

1 Like

My pleasure @Mitchell_Wells :grin: !

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.