views:

1266

answers:

1

Is it possible to make a group and sort conditional? If so, is it possible to somehow do this based on the value of a textbox item?

I thought I could just set the Expression of the group and sort to something like =IIF(ReportItems!TheTextBox.Value = 0, 0, Fields!FieldName.Value), which would be perfect, but it doesn't allow me to use ReportItems in group or sort expressions =(

Really don't want to make two reports whenever I need that feature... hope someone can shed some light on this!

Using:

  • Microsoft reporting services
  • Report viewer with local processing
A: 

edit

It is a sub-report, so I can't use report parameters.

you can. see How to: Add a Subreport and Parameters (Reporting Services)
/edit

Try to check this report parameter collection in grouping expression. Something like:

=IIF(Parameters!<ParameterName>.Count = 0, 0, Fields!FieldName.Value)

See Using Parameters Collection References in Expressions (Reporting Services)

Max Gontar
I can't use report parameters in a sub-report without defining them in the master report and also specify which ones to "send down" to the sub-report. And I just don't want to do that really.
Svish
Not because I'm just difficult, but because the master report works as a master template for many reports, taking care of page numbers and various information that must be on every report. Also helps to make them all look the same.
Svish