Custom Sort

I need a bit of help with the following that I think I might be needing to integrate sort or orderedby expressions but I am not sure.

My Data:

Global Status Table
2X_d_d2cbf966f92190d8f51a9505fa8759e8400d8deb.png

Product Table
-Global Status is Ref to the Global Status Table

2X_0_09d7cb52fcca549cbd1473faef37e24d38ec5fed.png

Product View
-Global Status is

2X_6_6f4e1ce022da05e62dc798387a5d365d84b3f3b9.png

Questions:

I only have the option to sort Global Status by Ascending or Decending order. How do I sort in either:

  1. Custom selecting / sorting the data records in Global Status column (Similar to custom sort in excel)
    or
  2. Sort by the numercial order added in Global Status Order without needing to unnessasary pull the data into the Product table via a Virtual Column and sort by that instead.
0 10 1,787
10 REPLIES 10

Hi @Michael_Pinto!

Iโ€™m not sure if this is what you need but I wonder if simply using a table view with headers in AppSheet might not give you the capacity you are looking for. If you have headers in an AppSheet table, the user can choose the header to tap on to order the records by that column, and then tap again on the same column to reverse the order. Please see โ€œHow do I get headers to show?โ€ in the following:

Hi Kirk

I familiar with sorting capabilities on the header and unfortunately that does not solve my issue. Sorting it this way still means that the data is sorted alphabetically, where as I needed it to be custom sorted to my specifications to help facilitate my users see relevant data 1st.

To give you an example of what I see in my app vs what I want.

Current sort (Alphabetical)

Requested sort
I would like to rather sort as follows:

  1. Commercial
  2. Commercial Introduction
  3. Commercial Delete

I see. Thank you for explaining that. Iโ€™m afraid I donโ€™t have enough knowledge to help. I hope someone else can. Perhaps @Aleksi, @Steve, or @LeventK.

@Michael_Pinto In general, Sorting can only be done with the data available to the sort function. So, if you cannot get the data sorted in the order you wish with the data you have, you will have to introduce data that allows the sort order you wish.

In your case, I would recommend assigning a Code value to the Global Statusโ€™s. In other words, a separate hidden column that has a value that you solely use for sorting.

I also recommend using values such as 10, 20, 30, etc rather than 1,2,3. If in the future you decide to add statusโ€™s that go between existing ones, then you only need to choose a sorting number value in between like 5, 15, 25, etc.

It appears you want the groupings sorted non-alphabetically in a table view. The only way to accomplish what you want is to prefix the group names with a number (or other prefix) that will sort as you want. For instance, make the group names literally 1. Commercial, 2. Commercial Introduction, and 3. Commercial Delete, with the 1., 2., and 3. actually in the names.

I was afraid of that, but thank you for the support

Yes, @Steve is correct. I didnโ€™t catch that you wanted the Groupings themselves sorted. Sorry about the confusion.

I have played with AppSheet trying to see if I can get Group Sorting accomplished some other way but there just isnโ€™t. Many others have seen the same problem. I have opened the Feature Request below for it. It just needs attention from other developers to get it prioritized.

FYI, I focused on Ref columns in the Feature Request because if you are applying a custom sort for Group headings, you will likely want to do something like what i described above. The best way to manage that is in its own utility table and then Ref to it - not within your data tables.

Iโ€™m having the same problem regarding how to customize my own sorting. But what I did, I make a virtual column name โ€œRef Sortโ€ then use the switch formula.

In using formula Switch you can assigned value which will be used in your View Options.

The sample of the Switch formula:

switch([Priority_Level],โ€œDelayโ€, โ€œP0โ€, โ€œNormalโ€, โ€œP1โ€, โ€œHighโ€, โ€œP2โ€, โ€œP3โ€)

Note: Virtual Column DataType must be in โ€œTextโ€.

translating:

Switch([Source Column], โ€œvalue1 in the columnโ€, โ€œcharacter to replace value1โ€, โ€œvalue2 in the columnโ€, โ€œcharacter to replace value2โ€, โ€ฆโ€œDefaultโ€)

Then use the Virtual Column โ€œRef Sortโ€ in view options โ€œSort Byโ€

Hope this helps.

If you have a reference list already in the desired order, you can sort a different list containing some subset of the values in the reference list using INTERSECT():

INTERSECT(
  {"High", "Normal", "Low"},
  {"Low", "High"}
)

would produce a two-item list with the values: High, Low, in that order.

Going to have to play with these ideas. Looks like good work around options guys.

Have a Merry Christmas guys!

Top Labels in this Space