Dynamic Grouping

Stimulsoft Reports.NET discussion
Post Reply
beginner
Posts: 36
Joined: Thu Jun 18, 2015 5:01 am

Dynamic Grouping

Post by beginner »

I'm looking for a way to let the user choose grouping condition.

I've tried by defining a variable: `group`, and setting Group Header Band's condition to that. In server-side, I fill this variable with column names like `{DataSource1.CostCenterName}`. It doesn't seem to be working. I also tried it without curly brackets, '{'.


Please let me know if there's a way to implement this, with variables or any other way that you might suggest.


Thanks for your support,
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Dynamic Grouping

Post by Jan »

Hello,

I have created a sample report for you. Please check attached report. In report you need create a boolean report variable. Also you need add condition to the group header band which uses this variable. Please check attached images.

Thank you.
Attachments
Group-With-Conditions.mrt
(35.39 KiB) Downloaded 383 times
Image2.png
Image2.png (234.79 KiB) Viewed 2217 times
Image1.png
Image1.png (20.95 KiB) Viewed 2217 times
beginner
Posts: 36
Joined: Thu Jun 18, 2015 5:01 am

Re: Dynamic Grouping

Post by beginner »

I have several different groupings, e.g. based on customer, date, etc. So, the only way to implement this is to put all of the group headers in the report and disable or enable them based on user's selection? Isn't there any way to pass the column name in a variable? This way I can have only one group header in the report, and fill it with any column name that I like (I never do two or more groupings simultaneously)

Thanks for your attention Jan,
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Dynamic Grouping

Post by HighAley »

Hello.

You could do it in code after loading of the report template with next code:

Code: Select all

var group = report.GetComponentByName("GroupHeaderBand1");
(group as StiGroupHeaderBand).Condition.Value = "{Products.SupplierID}";
Or you could use Choose() function in Group Header condition like in the attached report template.
Report.mrt
(22.88 KiB) Downloaded 331 times
Thank you.
Post Reply