2012年2月17日星期五

Disable grouping

I would like to be able to disable grouping depending on the value of parameter. At the moment I have the following expression for grouping:
=IIf(Parameters!Group2.Value.equals(""), false, Fields(Parameters!Group2.Value).Value)

What I am trying to do is if the value of the Group2 parameter = "" turn off grouping. Group2 is assigned a value from the following custom code:

Function Group2Value() As String
Dim Group As String
Group = ""
Select Case Report.Parameters!ReportType.Value
Case "1"

Group = ""

Case "2"

Group = "CategoryID"

Case "3"

Group = "StockFamilyID"

Case "4"

Group = "GroupID"

Case "5"

Group = ""

Case "6"

Group = "SaleableGLCodeID"

End Select
Return Group
End Function

However this is not working.

Can grouping be disabled and if so what am I doing wrong?

Thanks in advance.
can't you just set grouping to =1 ?

this technique can also be used in a matrix when you need an extra grouping for e.g. to display count AND amount but don't physically want to group the data|||

Yes, Grouping can be disabled.

Try doing the entire calculation in the custom code and place the name of the function in the expression for Grouping.

The Grouping expression as =Code.Group2Value()

Now based on whatever value is returned from the function Group2Value, the grouping will be done accordingly.

Regards,

Pradeep

没有评论:

发表评论