Question

=IIF (Fields!LastGiftDate.Value >0, (Format(Cdate (Fields!LastGiftDate.Value),"dd-MM-yyyy")), " ")

This above query give me space if there is no date but it will give me #Error if there is a date value. Help.

Was it helpful?

Solution

You need to use isDate function to determine if its a date or not. Also SSRS iif condition are not short circuited.

=IIF (isDate(Fields!LastGiftDate.Value) 
     ,IIF (isDate(Fields!LastGiftDate.Value), (Format(Cdate (Fields!LastGiftDate.Value),"dd-MM-yyyy")),NOTHING)
     , " ")

OR

=IIF (isDate(Cdate(Fields!LastGiftDate.Value)) 
     ,IIF (isDate(Fields!LastGiftDate.Value), (Format(Cdate (Fields!LastGiftDate.Value),"dd-MM-yyyy")),NOTHING)
     , " ")

OR (Try to run ignoring short cicuit behaviour)

=IIF (isDate(Fields!LastGiftDate.Value), (Format(Cdate (Fields!LastGiftDate.Value),"dd-MM-yyyy")), " ")

OR

=IIF (isDate(Cdate(Fields!LastGiftDate.Value)), (Format(Cdate (Fields!LastGiftDate.Value),"dd-MM-yyyy")), " ")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top