0
votes

I have a report that the user can choose to group by a certain field or not. I used the following group expression:

IIf(Parameters!rptGroup.Value = "none", "", Fields(Parameters!rptGroup.Value).Value)

It works fine when I choose to group and provide a value for the rptGroup parameter. But when I chose not to group and set the rptGroup parameter to "none", I expect it to group by nothing (so no grouping). But I get an error that says "none" is not a field in my dataset which confuses me because the "iif" statement should be evaluating the true part of the statement and returning "", right?, instead trying to evaluating the value "none" in the false part of the statement and of course not finding it as a field in my dataset. Do i have the wrong idea here?

I have a visibility expression to hide or show the group header and footer based on the value of the the rptGroup which is fine.

1

1 Answers

1
votes

Not sure if this is the best approach or not but what I have done in the past is to add additional columns to my dataset feeding the report. These columns will be group1, group2, group3... (as many as you need) then populate them with the data you want to group by in the source data. If they are left un-populated then the report won't be grouped and you can then use a simple formula to hide the group headers and footers if you like.