Can you do secondary sorts within a view?
L

I would like to have a view that made one column the primary sort, but when that column had duplicate entries, be able to sort by a second column.  For example a column for "order number" and a secondary column for "line item".

Ninox Profile

Larry,

This is possible with a third formula column where you combine the two columns to be sorted.

In table view click on the column header and click “Show Column” Button and chose Formula.

You go straight to the formula text editor where you can combine the two columns needed to be sorted.

E.g.: fieldone + "-" + fieldtwo

You can now chose this third colunm to be sorted.

Ninox Profile

 Steven, that works kind of OK for my similar situation (fields SUBMISSION DATE and PAGES) - but it mashes the fields together and forces both to sort in the same direction. Can one field sort descending and then the other sort ascending? Is there a piece of script to make that happen?  I want to most recent submission date items at the top, and the pages to start with 1 at the top. 

Ninox Profile

You could make a extra formule field (DatesPast) where you do something like this : number(today() - 'SUBMISSION DATE") so in that field the smallest number is the most resent date. Now, do like my answer above with this: DatesPast +"- "+PAGES. Now order this ascending. The youngest dates will be above together with the leat pages.

Ninox Profile

Thanks - I'll give it a go.

Ninox Profile

I can't find a way to sort on fields of different types. In this instance i have a date field (date type) and and number field (number type). I want to sort primarily by date but, when dates are the same, use the number field to determine sort order. Creating a formula field by adding the date and the number field togther just ignores the nukber field

Ninox Profile

Hi Simon,

Please concatenate the two fields as text: 

 

text(myDate) + text(myNumber)

 

 

Best, Jörg

 

Ninox Profile

Thanks Jorg, but I'm afraid that all that does is sort all the dates so that the first of each month comes first, then all the second of the month and so on, finishing with all the 31sts, ignoring the fact that they are actually dates

Ninox Profile

Simon, Jörg's formula worked for me, but you could also try it like this...

 

number(DateField) + NumberField

Ninox Profile

Thanks Sean, your solution produces a fascinatingly long number (presumably minutes since the Big Bang!) but does seem to sort correctly. Cheers!

Reply