Michigan Man
Michigan Man

Reputation: 101

IIF and Date logic and format for SSRS

I have the following code

=IIF(Month(Fields!effectivedate.Value) <> Month(Now()), Now(), Fields!effectdate.Value)

In this code I check to see if Fields!effectivedate.Value is the current month.

In addition to doing this check I would like to check for another value, fields!Freeze.Value

Here is how it would look in VB.NET code

If fields!Freeze.Value = true
     Fields!effectdate.Value
else
     IIF(Month(Fields!effectivedate.Value) <> Month(Now()), Now(), Fields!effectdate.Value)
end if

How would I write this in SSRS code?

Please ask for further clarification if i have failed to explain something properly.

Upvotes: 0

Views: 961

Answers (2)

glh
glh

Reputation: 4972

You will need to use a nested IIf function as started by @lc. however you need to be more clear what you want to check for in the Freeze field.

For example you can check for blanks using the IsNothing() function, or if its a booleon you may need to see if Fields!Freeze.Value = 1.

Upvotes: 0

lc.
lc.

Reputation: 116438

Just nest the IIfs:

=IIf(Fields!Freeze.Value, Fields!effectdate.Value, IIF(Month(Fields!effectivedate.Value) <> Month(Now()), Now(), Fields!effectdate.Value))

Upvotes: 1

Related Questions