Back to forum list… Back to How Do I?...

Question on a Conditional Statement (4 replies)

Arline Welty
7 years ago
Arline Welty 7 years ago

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

https://www.realisable.co.uk/wp-content/uploads/2017/08/Conditional-Statement_NoLineBreaks.jpg
D Dunn
7 years ago
D Dunn 7 years ago

IIF is a function so you need to enter it as:

IIF(%Product1PurchaseDate="0000-00-00 00:00:00",NULL,%Product1PurchaseDate)

 

Arline Welty
7 years ago
Arline Welty 7 years ago

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)

D Dunn
7 years ago
D Dunn 7 years ago

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'.

6 years ago
D Dunn 6 years ago

Closed due to inactivity.

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close