Sorting by two fields (OrderBY)

I am looking to sort by two fields, NumNote and Payment_Type.

When I do the order by with only one field, I have no problem ๐Ÿ˜„, but when I integrate the second one it doesn't work and I don't understand why๐Ÿ˜ฃ ; any idea what I'm doing wrong? This is the instruction that I use

<<Start:ORDERBY(FILTER("Notes",AND([Service_Type]=[_THISROW-2].[Service_Type],[Payment_Type]=[_THISROW-1].[Payment_Type],[Date_Input]>=[FromDate],[Date_Input]<=[ToDate])),[Note_Number],[Payment_Type],true )>><<[Note_Number]>>

Thank you very much!!!

Solved Solved
1 6 292
1 ACCEPTED SOLUTION

How is it NOT working?

One thing to watch out for is that when you use a reference field in the expression, the key value is used instead of the label that you see in UX (i.e. customer id, customer name)  unless you de-reference it.

 Both caterory_id and subc_id are references and unless you de-reference them you get a result that is different from what you see in the table view (where it is sorted by category_id only)

TeeSee1_3-1668208356527.png

TeeSee1_1-1668208244683.pngTeeSee1_2-1668208261661.png

View solution in original post

6 REPLIES 6

Change

[Note_Number], [Payment_Type]  (comma not valid here)

to

[Note_Number] & [Payment_Type] (Concatenate required fields)

Many thanks @TeeSee1 unfortunately, it didnยดt work ๐Ÿ˜ญ

How is it NOT working?

One thing to watch out for is that when you use a reference field in the expression, the key value is used instead of the label that you see in UX (i.e. customer id, customer name)  unless you de-reference it.

 Both caterory_id and subc_id are references and unless you de-reference them you get a result that is different from what you see in the table view (where it is sorted by category_id only)

TeeSee1_3-1668208356527.png

TeeSee1_1-1668208244683.pngTeeSee1_2-1668208261661.png

Thank you very much for your comments @TeeSee1 , I will check again based on what you indicate to see if I did something wrong, although I really only added the & as you indicated. Regards

Steve
Platinum 5
Platinum 5

You're using ORDERBY() incorrectly.

ORDERBY() - AppSheet Help

Ups, thanks @Steve