This is a migrated thread and some comments may be shown as answers.

Cross tab report: Sorting

5 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Deepak Saboji
Top achievements
Rank 1
Deepak Saboji asked on 16 Feb 2010, 01:12 PM
Hi,

I have created a Cross tab report using the Cross tab control. There is one drop-down list on report that contains columns to be sorted on the report. Would you please suggest me the way to sort the Cross tab report with the selected column name in the drop-down list?

Thanks,
Deepak Saboji

5 Answers, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 19 Feb 2010, 03:23 PM
Hello Deepak Saboji,

The Table/Crosstab report item has a Sorting property which allows you to specify any expression as a sorting criteria. In this regard sorting the Table/Crosstab by a dynamically chosen column is simply a matter of specifying a proper sorting expression. For example, you can use the IIf() built-in function to decide by which column to sort according to the value of a report parameter. Since I am not familiar with your specific scenario I cannot give you an exact solution. However I have attached a small sample report which illustrates the suggested approach instead. In order to run the sample on your machine you will need the AdventureWorks sample database, which comes with every installation of our product.

Greetings,
Ivan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Deepak Saboji
Top achievements
Rank 1
answered on 30 Mar 2010, 08:39 AM
Hi,

The sample provided by you is using 'Telerik.Reporting.Table' to display data but my query was related to 'Telerik.Reporting.CrossTab'. In my scenario 'CrossTab' has a 'Result' field which is RowGroup and 'Subjects' as ColumnGroup. This means columns will be generated dynamically when I bind DataSource to the CrossTab.

example:
-------------------------------------------------
Sub1 Sub2 Sub3 ...
-------------------------------------------------
Result1 2 1 3
Result2 1 1 2

Now my problem is, how can I in check 'Field.Subject' in IIf() for a particular subject column. I tried  '= IIf(Parameters.SortColumn = "Sub1", Fields.Subject, "Sub1")' but its not working.

Thanks and regards,
Deepak Saboji

0
Ivan
Telerik team
answered on 01 Apr 2010, 04:44 PM
Hi Deepak Saboji,

Thank you for the clarification and the provided example. If I understand you correctly, you need to sort the row groups of the Crosstab by the result of an aggregate function that works on the scope defined by the intersection of the current row group with a specific column group, e.g. sort the 'Result' row groups of the Crosstab by the Sum/Count of the detail values where the 'Subject' column group is 'Sub1'. This in fact will sort the generated rows of the Crosstab by the 'Sub1' dynamic column. I am afraid that currently there is no way 'out of the box' to accomplish this, however you can achieve the same result with the help of a custom aggregate function. To illustrate this approach I have attached a small test project that allows you to sort the rows of a Crosstab by a given dynamic column specified by a ReportParameter. The Report uses the SliceSum(...) custom aggregate function that sums only the detail values which meet a certain criteria, e.g. sum the values where 'Subject' is 'Sub1'. You can refer to our online documentation for more information about how to implement user aggregate functions.

Regards,
Ivan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Scott Li
Top achievements
Rank 1
answered on 09 Apr 2010, 11:02 PM
Hi

I really want to open the sample you attached, however, I can not as you were using VS 2008, can you make it in VS 2005, so I can open it.

Thanks

Scott
0
Ivan
Telerik team
answered on 14 Apr 2010, 05:56 PM
Hi Scott Li,

I have converted the sample solution for Visual Studio 2005. You can find both the 2005 and the 2008 solutions attached to my post.

Kind regards,
Ivan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Deepak Saboji
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Deepak Saboji
Top achievements
Rank 1
Scott Li
Top achievements
Rank 1
Share this question
or