Strange sort order for strings

Posted by: mikedempsey on 8 September 2017, 3:14 pm EST

  • Posted 8 September 2017, 3:14 pm EST

    A customer has data returned from a database that contains a VARCHAR (ie. string) column.
    When he sorts on that column it puts rows that contain only spaces first [as expected] but it puts 'empty' strings last [not expected].

    I read somewhere in the forum that nulls sort last - but there is a difference between nulls and empty strings.

    All the different vendor databases I have tested with sort empty strings first - similar to spaces.
    (Nulls can sometimes be specified to sort First or Last as required ... but that has no effect on the order of empty strings.)

    Is this a bug in Spread or was it intentional? (if so, why?)

    Note that this is Spread 7.

    Thanks
    Mike
  • Replied 8 September 2017, 3:14 pm EST

    Hello Mike,

    This is not a bug in Spread. If you will try sorting a column with empty cells in Excel, you would observe that those cells are placed at last as each control or database uses its own sorting algorithm.
    Hope it clarifies.

    Thanks & Regards,
    Pragati Kaushik
  • Marked as Answer

    Replied 8 September 2017, 3:14 pm EST

    OK. Thanks.
    I never thought of checking what Excel did ... I'm so used to using databases.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels