Switch / choose / IIf in expression
Can someone give some examples for Switch and choose Statements to use in Expression like IIf. thanks. also i need to know how to check for the null value. IsNothing and IS System.DBNull.Value doesn't seem to work. =IIf( Fields!mmActDate.Value IS System.DBNull.Value, MonthName( Fields!mmPlanDate.Value ),MonthName( Fields!mmActDate.Value )) I get a warning message for this, The value expression for the textbox mmActDate contains an error: Argument 'Month' is not a valid value. thanks.
October 5th, 2005 9:49pm

Try isnull function instead? =IIF(isnull(Fields!mmactdate.value,'01/01/1900')='01/01/1900',.... or something to that effect? (not sure about date format in your db.) Here's more info on the switch functionality, but you may want to just investigate custom code & a function if you're getting too complex. cheers, Andrew
Free Windows Admin Tool Kit Click here and download it now
October 6th, 2005 2:57am

Try this instead:=MonthName(iif(IsNothing(Fields!mmActDate.Value), Fields!mmPlanDate.Value, Fields!mmActDate.Value))-- Robert
October 6th, 2005 3:43am

The following worked for me ...= IIF(Fields!Desk.Value is NOTHING, 0, Fields!Desk.Value)The 0 (zero) is the true value, followed by the false value.
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2005 10:12pm

Thanks Craig. This solution helped me!
October 16th, 2005 9:56am

I noticed everyone gave answers, but none ever gave examples on the SWITCH expression here is what I found in BOL.=Switch(Fields!PctComplete.Value >= .8, "Green", Fields!PctComplete.Value >= .5, "Amber", Fields!PctComplete.Value < .5, "Red")
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2006 10:54pm

This worked like a charm, thanks Robert!
June 9th, 2011 4:33pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics