Page 1 of 1
Sorting a varchar field
Posted: Mon Sep 27, 2010 9:14 am
by MikeC
I have a field that needs to be sorted. It's a varchar field that looks like the following:
1
2
3
3A
4
4A
4B
5
6
6A
6B
6C
11
12
20
Since it's varchar when I just sort it normally I end up with:
1
11
12
2
20
etc....
What's the method to correctly sort varchar fields?
Sorting a varchar field
Posted: Tue Sep 28, 2010 5:54 am
by Andrew
Hello,
Sorry we cannot understand your question. Could you, please rephrase it or explain your task in detail?
Thank you.
Sorting a varchar field
Posted: Tue Sep 28, 2010 6:32 am
by albloshi
I also face the same problem
The scenario is that
I have a string column in a dataset
its has the following data
1
2
3
4
4A
10
12
20
22
When this column is placed on the report in the band and this column is sorted
it give
1
10
12
2
20
22
3
4
4A
I also require answer for that
Sorting a varchar field
Posted: Tue Sep 28, 2010 7:35 am
by Alex K.
Hello,
The question is not quite clear. If you want to get the data in the order they are in your DataSource, please do not sorting by this field. Since this field is of the string type, then it sorts them as string.
Thank you.
Sorting a varchar field
Posted: Tue Sep 28, 2010 3:28 pm
by xss
Hi,
since the field type is string, it sorts as string. Pad the string with leading zeros.
Cheers.
Sorting a varchar field
Posted: Wed Sep 29, 2010 12:23 am
by mrapi
Just in idea : follow xss and create a second field just for sorting and display your original field
Sorting a varchar field
Posted: Mon Oct 04, 2010 9:16 am
by Jan
Hello,
You can use expression for sorting dataset not only reference to datacolumn. If expression convert your value to numeric. For example:
{decimal.Parse(MyDataSource.MyDataColumn)}
Thank you.