0

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

9replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 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.

    Like
    • David
    • David
    • 3 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. 

    Like
  • 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.

    Like
    • David
    • David
    • 3 yrs ago
    • Reported - view

    Thanks - I'll give it a go.

    Like
  • 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

    Like
  • Hi Simon,

    Please concatenate the two fields as text: 

     

    text(myDate) + text(myNumber)

     

    Best, Jörg

    Like
  • 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

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

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

     

    number(DateField) + NumberField

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

    Like
Like Follow
  • 2 yrs agoLast active
  • 9Replies
  • 3749Views