Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDLC Multiple Columns Sorting: Sorts Numbers as Strings Issue

I’m working on a .Net 4.0 web project that uses Microsoft RDLC Reporting framework with a local processing mode and my problem is I have to sort the tabular data with a dynamic column names string array parameter so when i researched on the internet(sorry i don't have the actual links for the research with me now) I found that I have this options.

  1. Use interactive sorting – which I can’t use b/c the sorting columns are not pre-defined and I have more columns that are not visible(no header or column) but still participate on sorting.
  2. Use Sorting tab on the tablix properties – This is an ideal solution to my problem but now I’m stuck on an issue.

I found on the internet that one can specify sorting fields in two ways on the sorting tab of tablix properties.

  • The First way is to Concatenate Fields using “&” on the first sorting fields using expression like this =Fields!Title.Value & Fields!EstimatedHours.Value This one will sort the data but it sorts Numbers as Strings meaning when you sort in an ascending order 250.00 will be always on the top of 3.6 I didn’t Test it on other data types like Date and so on but I’m sure it will result in the same thing.

  • The Second way that I found was to add a sort field expression textbox for every sort fields that I have on the Sort tab of Tablix Properties window like this.

  • On First Text Box => =Fields!Title.Value
  • On Second Text Box => = Fields!EstimatedHours.Value

On this way it will only sort the data on the first field that I gave it in the first textbox and it forget about the rest of the fields.

So my question is what am I missing here to make the above sorting work?

Thank you everybody in advance, and I hope I will fix the issue with your help. If it helps I’m using Visual Studio 2010 Ultimate Edition, RDLC Version 10, Entity Framework 5 and Object DataSourceControl with custom method which returns List of my custom objects to populate the report.

like image 533
Sisay Kelkle Avatar asked Jan 27 '26 13:01

Sisay Kelkle


1 Answers

I solved my issue. The trick was specifying the sort columns in the RDLC file on the details group->group properties -> sorting tab rather than putting them on tablix properties -> sorting tab. That solved my issue perfectly. Hope it helps someone.

like image 88
Sisay Kelkle Avatar answered Jan 29 '26 02:01

Sisay Kelkle