# Sort Entity drop-down lists by public ID?

**URL:** <https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526>\
**Category:** Ideas & Features\
**Created:** [February 10, 2022, 2:29pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526 "2022-02-10T14:29:30Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [February 10, 2022, 2:29pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/1 "2022-02-10T14:29:30Z")

</div>

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/

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [February 10, 2022, 3:48pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/2 "2022-02-10T15:48:52Z")

</div>

Perhaps we could get the [hidden “Rank” field](https://community.fibery.io/t/how-to-access-entities-natural-sort-order-in-rules-buttons-scripts/1967) promoted to “non-hidden”, so that it could be used in Sorting views?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [February 10, 2022, 3:53pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/3 "2022-02-10T15:53:43Z")

</div>

> [@Mikkling](#):
>
> i cannot figure out how to use them in formulas

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

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [February 10, 2022, 10:52pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/4 "2022-02-10T22:52:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [February 11, 2022, 2:30pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/5 "2022-02-11T14:30:26Z")

</div>

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

> [@Mikkling](#):
>
> they should appear in logical order in the selection drop-down list

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](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/1/1b815c87a8d84222a3946bd04d7ac6199cae44df.png)

You can rearrange the order using the ‘handle’ → ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/f61984bf4d59999adf39840f2f8b2f3aa796f722.png)

> [@Mikkling](#):
>
> 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?

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:

> [@Button formula: How to update a single-select field](https://community.fibery.io/t/button-formula-how-to-update-a-single-select-field/2193/11):
>
> A good way to visualise it (literally) is to actually open a single-select value (alt-click on its name) and you will see all its properties (colour, icon and linked entities). Try it slight_smile

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [February 11, 2022, 2:47pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/6 "2022-02-11T14:47:52Z")

</div>

Thanks! I’ll check this out.

---

<div class="post-metadata">

**Author:** ![Mikkling](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mikkling](https://community.fibery.io/u/Mikkling)\
**Post date:** [February 12, 2022, 1:16pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/7 "2022-02-12T13:16:15Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/2/2a500871a82067dc24d1e7c4a78dfbbb6b30342d.png)

The drop-down list when i select Priority for a given Issue. Alphabetical order = annoying.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/fa2cfd8024be526f3e0ea96317ba4f0545118c0a.png)

Ugly workaround

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/7/73e148788964b342f68268d1dacf52be55c28977.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/b/b97cc9b78f9e166f945b938b3ae9623fe5def7c6.png)

**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/

---

<div class="post-metadata">

**Author:** ![helloitse](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/helloitse/32/498_2.png) [@helloitse](https://community.fibery.io/u/helloitse)\
**Post date:** [March 15, 2023, 9:56pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/8 "2023-03-15T21:56:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [March 16, 2023, 3:50am UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/9 "2023-03-16T03:50:28Z")

</div>

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™

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [March 16, 2023, 3:30pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/10 "2023-03-16T15:30:20Z")

</div>

> [@Matt\_Blais](#):
>
> 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.

Today we found out that this is also exactly what we need 😅

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.

---

<div class="post-metadata">

**Author:** ![mdubakov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mdubakov/32/10_2.png) [@mdubakov](https://community.fibery.io/u/mdubakov)\
**Post date:** [March 16, 2023, 3:32pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/11 "2023-03-16T15:32:48Z")

</div>

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](https://the.fibery.io/@public/Public_Roadmap/Roadmap_Item/Filter-and-sort-in-relation-Field-selector-169)

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [March 16, 2023, 3:55pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/12 "2023-03-16T15:55:39Z")

</div>

That’s awesome! 😁

---

<div class="post-metadata">

**Author:** ![Marloes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/marloes/32/5926_2.png) [@Marloes](https://community.fibery.io/u/Marloes)\
**Post date:** [May 16, 2023, 8:19am UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/13 "2023-05-16T08:19:20Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/894153ec83fae65b8baa39aafb0e37f49445cadd.png)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 16, 2023, 8:51am UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/14 "2023-05-16T08:51:47Z")

</div>

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’).

> [@YvetteLans](#):
>
> Only thing we can do is sort via ugly workaround or public ID.

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

---

<div class="post-metadata">

**Author:** ![Marloes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/marloes/32/5926_2.png) [@Marloes](https://community.fibery.io/u/Marloes)\
**Post date:** [May 16, 2023, 9:21am UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/15 "2023-05-16T09:21:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [December 20, 2024, 1:27pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/16 "2024-12-20T13:27:03Z")

</div>

For completeness, here is a link to the announcement where relation sorts were added

> [@April 13, 2023 / Nested filters and color coding, relation sorts](https://community.fibery.io/t/april-13-2023-nested-filters-and-color-coding-relation-sorts/4312):
>
> nesting_dolls Nested filter groups [filters-groups] Previously, you had to choose whether all filters should be combined with and or with or. For any complex condition involving the combination of two, we suggested creating an auxiliary Formula as a workaround grimacing. With filter groups, you can combine the logical operators in any way you like: We’ve updated our [guide on Filters](https://the.fibery.io/@public/User_Guide/Guide/Filters-141) to reflect the new powers. art Advanced color coding The sam…

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [December 20, 2024, 1:27pm UTC](https://community.fibery.io/t/sort-entity-drop-down-lists-by-public-id/2526/17 "2024-12-20T13:27:07Z")

</div>


