Sort Entity drop-down lists by public ID?

I tend to use entity relations instead of single-select fields (because i cannot figure out how to use them in formulas). For instance, i want to assign priorities to Tasks and i do that with a one-to-many Priority-to-Contact relation, which works well, albeit a bit cumbersome to use in formulas with the Priority.Filter().Sort().First() expression.

Since there’s a logical order to the different priorities, it would be nice if they could be sorted by public ID instead of lexical order when i select a priority for a Task in its Priority field. I would really like to avoid prefixing the priorities with 1, 2, 3… since it is ugly.

\m/

Perhaps we could get the hidden “Rank” field promoted to “non-hidden”, so that it could be used in Sorting views?

2 Likes

Perhaps we can help you. What would you ideally want to achieve?

1 Like

I would like there to be an way to implement a categorization field for entities in DB that is easy to reference in a formula. I mean, the categories should be formula-accessible as Category.Name or Category[index]. Also, they should appear in logical order in the selection drop-down list, rather than alphabetical order.

Going into single-select fields, I have learned from this forum that single-select fields are actually obfuscated entities, but i have found no single example of how to actually use them in a formula. Say i have an if() automation for Contacts that should return the single-select field value “Tier 1” on true and “Tier 2” on false, how do i reference them in the formula?

Select fields act like types, so if you want to reference them in a formula, you need to reference a field, like Name.
If I have a database called DB, with a select field called Select, then in a formula, I can get the chosen Select for a given DB entity using the formula
Select.Name

And when you say

then it should be the case that the possible options for select drop-down are returned in the order in which they have been configured (not alphabetical order).
image

You can rearrange the order using the ‘handle’ → image

I’m not sure I understand what you’re trying to achieve here. Do you mean that you want to be able to set the value of a select field using an automation?
If so, then you’ll want to read this:

2 Likes

Thanks! I’ll check this out.

Sorry if i was unclear!

The issue of logical order does not concern single-select fields. Say i have an Ideas DB and a Category DB with a many-to-one relation. When i manually select a Category for an Idea, the drop-down list is in alphabetical order. I would like them appear in the logical order in which i defined them, e.g. their public id.

Edit: actual examples

My Priority-Issue relation

The drop-down list when i select Priority for a given Issue. Alphabetical order = annoying.
image

Ugly workaround


image

Edit 2: and the reason i set Priorities as an Entity is because i want to be able to set priorities by automations, which i cannot do with single-select fields.
\m/

1 Like

Coming back around to say this recommendation is genius. I hope we get this feature soon

1 Like

I think the best solution would be to have somewhere to define, for each DB, how its entities should be sorted in relation-field pick-lists. The most obvious choices are:

  • by Name alphabetically
  • by internal Rank (as manually ordered in a List view)
  • by Fibery Magic™
1 Like

Today we found out that this is also exactly what we need :sweat_smile:

We have a similar situation for a ‘lead status list’; needed a DB instead of single select because of automations.

And now we can’t get the sorting right. Only thing we can do is sort via ugly workaround or public ID. But both are not optimal.

Sort and Filter in relations is in progress, stay tuned, it will be released in few weeks

https://the.fibery.io/@public/Public_Roadmap/Roadmap_Item/Filter-and-sort-in-relation-Field-selector-169

2 Likes

That’s awesome! :grin:

In addition to the filter and sort in relation field option.

I found out that by default there is a sorting on the relational database field (Name ascending).

We use these relational databases for different purposes, for example, for priorities and lead status. In every database where I relate to this priorities database I have to take off the default sorting. We do not want it sorted by alphabet, but by order in the database. So in most cases we don’t need any sorting at all.

Now I don’t know what the desired behavior of the sorting is for the other users. Perhaps I am the only one who does not like a default sorting, but wanted to at least pass this on.

Prior to the implementation of relation sorting, the options were always sorted in alphabetical name order. In order not to break this, when the sort options feature was made available, sorting alphabetically on name was automatically applied by default.
As you say, it can be removed if not appropriate (in which case, they will sort on ‘rank’).

Fyi, sorting on public Id is almost effectively the same as sorting on Creation Date

1 Like

A this makes sense! Will remove the sorting manually where we don’t need it. Was curious why it would behave this way.