Page 1 of 1

Sort as number, not as text

Posted: Wed Sep 19, 2007 6:33 am
by incognito_gbg
I have a report where I want a databand to be sorted by a number-column.
The datasource in the stimulreport is generated from an xml-schema, to which a xml-file is bound duringruntime.
The valuetype of the number in the xml-schema is assigned as

But when I run it, the numbers come out in orders like:

1
10
17
2
24
3
35


instead of

1
2
3
10
17
24
35

How should I solve this?

Sort as number, not as text

Posted: Wed Sep 19, 2007 6:47 am
by Edward
Please check the type of the Column in the Designer. Please change type with right-click on the appropriate column and choose Edit from the context menu.

When it is not possible to change the type of the Column, please do the trick: Sorting via GroupBand. Place a GroupBand before DataBand and in Condition of the Group type something Like this:

{int.Parse(MyDataSource.MyColumn.ToString())}

Thank you.

Sort as number, not as text

Posted: Wed Sep 19, 2007 6:59 am
by incognito_gbg
I have checked the column in the designer, and it is set as "byte".

Tried to put the code you posted in a new groupheader below my existing one, but that just messed the report up.

Sort as number, not as text

Posted: Wed Sep 19, 2007 7:11 am
by EDV Gradl
Maybe setting the sort option to this could help:

MyColumn.ToString().PadLeft(10,'0')

Hope that helps,

Marco

Sort as number, not as text

Posted: Wed Sep 19, 2007 7:18 am
by incognito_gbg
Hmm.........I cant find where I set the sortoption with code.....

Sort as number, not as text

Posted: Wed Sep 19, 2007 7:38 am
by EDV Gradl
If that does not work add a caluculated column with PadLeft.. and set the data to be sorted by this new column.

Marco

Sort as number, not as text

Posted: Mon Sep 24, 2007 9:00 am
by Vital
Please send your report to support [at] stimulsoft [dot] com.

Thank you.