Sort order is incorrect when dashes are present

Stimulsoft Reports.WEB discussion
Post Reply
Ryan Robar
Posts: 30
Joined: Fri Sep 20, 2019 3:46 pm
Location: Canada

Sort order is incorrect when dashes are present

Post 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.
Attachments
SortIssue.mrt
(8.92 KiB) Downloaded 175 times
Lech Kulikowski
Posts: 7336
Joined: Tue Mar 20, 2018 5:34 am

Re: Sort order is incorrect when dashes are present

Post 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.
Lech Kulikowski
Posts: 7336
Joined: Tue Mar 20, 2018 5:34 am

Re: Sort order is incorrect when dashes are present

Post 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.
Post Reply