Quantcast
Channel: VBForums - Reporting
Viewing all articles
Browse latest Browse all 594

nested iif problem

$
0
0
I have an expression to sum a number of fields

=Fields!quarter1.Value+Fields!quarter2.Value+Fields!quarter2.Value+Fields!quarter3

This works correctly as long as there are the 4 fields.

But depending upon what the user has specified there may only be 1, 2, 3 or 4 fields.
If there are not 4 fields it then fails and gives and error.

I thought I could use a switch statement but this also fails as it has to solve each switch element which it cannot do.

I think the answer is to use nested iif statements, but I don't think I have got the nesting correct
"error: [BC30516] Overload resolution failed because no accessible 'IIf' accepts this number of arguments"

Here is a siplified version of my iif statements.
I think I need the nesting deeper but am not sure.

=iif(Parameters!MyParam3.value=1,"Is 1",
iif(Parameters!MyParam3.value=2,"Is 2",
iif(Parameters!MyParam3.value=3,"Is 3",
iif(Parameters!MyParam3.value=4,"Is 4"))))

Viewing all articles
Browse latest Browse all 594

Trending Articles