Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic Grouping Crystal Reports 9

I have a crystal report that has a report parameter that can be a value between 1 and 100. If the value is less than 50, I need to group by CustomerID. If the value is greater than 50, I need to group by OrderID.

I've been searching the web on how to do this and I've come across several links that says this can be done via a formula. So inside the formula I have:

if {ReportParameter} < 50 then
    {TableName.CustomerID}
else
    {TableName.OrderID}

I created a group manually that correctly sifts through the data, but when I drag the formula into a grouped category, it's not working for me.

Is there an additional step I'm missing?

like image 458
coson Avatar asked Nov 15 '22 07:11

coson


1 Answers

OK, here is how I ended up doing this:

I defined the formula, but I didn't link the group to the formula. So I went back to the Group Header > Change Group > Change Group Options > Options Tab

and pointed to the name of my formula and it worked.

I thought that by adding the formula to the Group Header, CR would automatically associate my formula with the Group Header. DOH!!!

like image 136
coson Avatar answered Dec 22 '22 10:12

coson