Page 1 of 1

Not Sorting By Numbers Correctly

Posted: Sat Apr 06, 2024 1:08 am
by ericp
I have a report where I'm trying to sort by an Amendment Number. It seems to always be sorting by string only no matter what type I set the datasource to

For some reason, the output when I sort by ascending is showing up as:

100000
11
12
13
14
15
7
8
9

Instead of:

7
8
9
11
12
13
14
15
100000

Re: Not Sorting By Numbers Correctly

Posted: Sat Apr 06, 2024 1:08 am
by ericp
Also attached my sample report.

I ensured that the type of my source is changed to INT, but it still seems to be sorting by String.

Re: Not Sorting By Numbers Correctly

Posted: Sun Apr 07, 2024 7:15 pm
by Lech Kulikowski
Hello,

Please send us a sample report with test data for analysis.

Thank you.

Re: Not Sorting By Numbers Correctly

Posted: Mon Apr 08, 2024 2:19 am
by ericp
Hi Lech, please see the attached-

Re: Not Sorting By Numbers Correctly

Posted: Mon Apr 08, 2024 7:30 am
by Lech Kulikowski
Hello,

In your JSON, your column is stored as a string:
"Amendment#": "7"
for numeric should be:
"Amendment#": 7

Also, in your report you can use the following expression for sorting:
(decimal)(Projects.Amendment_)

Thank you.

Re: Not Sorting By Numbers Correctly

Posted: Mon Apr 08, 2024 4:23 pm
by ericp
Hey Lech, I tried using both (Decimal)(Projects.Amendment_) and {(Decimal)(Projects.Amendment_)}, but it still doesn't seem to be formatting properly.

As for the decimal you can see that i changed the type to decimal- doesn't that automatically make the "Amendment#" turn into 7 instead of "7"?

Are you able to send the report of it working? Thanks!

Re: Not Sorting By Numbers Correctly

Posted: Tue Apr 09, 2024 6:31 am
by Lech Kulikowski
Hello,

Please check the modified report.

Thank you.