1

Can you do secondary sorts within a view?

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".

9 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 6 yrs ago
    • Reported - view

    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.

    • David
    • 5 yrs ago
    • Reported - view

     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 partner
    • RoSoft_Steven.1
    • 5 yrs ago
    • Reported - view

    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.

    • David
    • 5 yrs ago
    • Reported - view

    Thanks - I'll give it a go.

    • Simon_Hall
    • 5 yrs ago
    • Reported - view

    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

    • Jorg
    • 5 yrs ago
    • Reported - view

    Hi Simon,

    Please concatenate the two fields as text: 

     

    text(myDate) + text(myNumber)

     

    Best, Jörg

    • Simon_Hall
    • 5 yrs ago
    • Reported - view

    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

    • Sean
    • 5 yrs ago
    • Reported - view

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

     

    number(DateField) + NumberField

    • Simon_Hall
    • 5 yrs ago
    • Reported - view

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

Content aside

  • 1 Likes
  • 5 yrs agoLast active
  • 9Replies
  • 4050Views
  • 1 Following