...so my sql view returns nvarchar as '123456' or 'JAN 11 2008 12:00AM' (view does a union on two tables and casts date to nvarchar).
I'm trying to apply some conditional date formatting i.e. I want to format the date by checking the "Type" column as:
=IIf(Fields!Type.Value = "COS", Fields!CosNoOrDateToContractor.Value, FormatDateTime (Fields!CosNoOrDateToContractor.Value, vbShortDate))
So basically if the type is a "COS" then just return the data as is, otherwise format it to a date.
When previewing the report if its a COS then I get #Error in the textbox (Conversion from string "123456" to type 'Date' is not valid.
It's anything else then data is formatted as date.
Does this make sense?
Anything wrong with the syntax or is what I'm trying to do not possible?
Have modified the view instead so I'm not casting dates to nvarchar.