Question on a Conditional Statement (4 replies)
IIF is a function so you need to enter it as:
IIF(%Product1PurchaseDate="0000-00-00 00:00:00",NULL,%Product1PurchaseDate)
Ah, yes that was perfect. Thank you, that's just what I needed! Thanks for sharing.
Turns out that NULL is invalid though. Do you know how I could take a value like Date and convert it to the format YYYY-MM-DD hh:mm:ss to match SQL Server's GETDATE() ? I've tried a few things but those aren't working quite right.
IIF(%Product1PurchaseDate="0000-00-00 00:00:00",Date,%Product1PurchaseDate)
IIF(%Product1PurchaseDate="0000-00-00 00:00:00",Now,%Product1PurchaseDate)
IIF(%Product1PurchaseDate="0000-00-00 00:00:00",CDate(Now),%Product1PurchaseDate)
Sometimes the black box is hard to puzzle through. Maybe turn it into text and check the first character? You should be seeing a '2' (at least for the foreseeable future). Anything else should be a 'fail'.
Closed due to inactivity.
Hi all,
I'm looking for a little assistance on a conditional statement. In my map transform, I want to pass through a NULL value (or what would be ideal, a current Date value in format YYYY-MM-DD HH:mm:ss)., but only if the current value is "0000-00-00 00:00:00" .
Here is the VB Script:
IIf %Product1PurchaseDate="0000-00-00 00:00:00" Then NULL Else %Product1PurchaseDate End If
But I'm getting the below error:
Unexpected Identifier [Then] expected [With]
The error changes if I remove line breaks. If I remove line breaks, I get:
Line=1;Pos=4; Unexpected identifier ["5/21/2006 12:00:00 AM"] expected [Xor].
Screenshot attached. Open to ideas! Thank you.
Arline