Page 1 of 1

Sort order is incorrect when dashes are present

Posted: Tue Oct 06, 2020 3:03 pm
by Ryan Robar
Most of the time when sorting strings, dashes are considered a higher value than any alphanumeric character. This does not appear to be the case in Stimulsoft. In fact, it seems that dashes are being ignored entirely by your sort. I've attached a report that illustrates this. There is embedded JSON in the report with some basic text to be sorted, along with what position the record should be once the set is sorted. Previewing the report, the set does not sort into the expected order.

In case there is some issue with the example, here's the example data:

Code: Select all

[
    { "Key": "AA", "Value": "5" },
    { "Key": "AB", "Value": "6" },
    { "Key": "AC", "Value": "7" },
    { "Key": "AE", "Value": "8" },
    { "Key": "A-D", "Value": "2" },
    { "Key": "A1", "Value": "3" },
    { "Key": "A3", "Value": "4" },
    { "Key": "A-2", "Value": "1" }
]
Sorting on Key, I would expect it to sort to the following:

A-2
A-D
A1
A3
AA
AB
AC
AE

Instead, I get this:

A1
A-2
A3
AA
AB
AC
A-D
AE

If there is a way to work around this (Using only 'Interpretation Mode', I'm in .NET Core, which doesn't support compilation, but that's another issue entirely) please let me know.

Re: Sort order is incorrect when dashes are present

Posted: Thu Oct 08, 2020 1:20 pm
by Lech Kulikowski
Hello,

This is a feature of string sorting in the NET Framework. strings are compared using special methods that can ignore some characters depending on their localization. for example, dashes are often simply ignored.

We need some time for investigations and find the solution. We will let you know about the result.

Thank you.

Re: Sort order is incorrect when dashes are present

Posted: Thu Oct 08, 2020 2:03 pm
by Lech Kulikowski
Hello,

We have added an additional option OrdinalStringComparison. You can set it to true
StiOptions.Engine.OrdinalStringComparison = true;

It will be available in the next release build.

Thank you.