Question
· Oct 30, 2019

Adding an OR condition in Data Transform

Hi,

I am trying to add an OR condition in the DTL but not able to. Sorry if this is a silly question, but can you advice?

I want to add a condition where if source.45 is "" or "..." then map "" to the target. But I am not able to add the OR condition

Currently I have as below

What will I need to do to add an "OR" condition to the DTL?

Would appreciate your guidance

Regards,

ED

Discussion (2)1
Log in or sign up to continue

Good morning Eric -

The logical operator for OR in a DTL is a double pipe - || - whereas an AND is a double ampersand - &&.

See: http://oairsintp.ssfhs.org:57772/csp/docbook/DocBook.UI.Page.cls?KEY=TCOS_Logical

So in your case, I'd recommend an IF/ELSE block 

IF source.PROP45 = "whatever" || source.PROP45 = "whateverelse"

set target.{PD1.AdvanceDirectiveCode(1).identifierST}     trueoption

ELSE

set target.{PD1.AdvanceDirectiveCode(1).identifierST}      falseoption

There are also some built in functions the DTL editor provides to do it all in one line. It comes down to preference on readability, in my opinion. 

EDIT - here's an example using the AND operator in the DTL (&&) but in much the same way, you could use an OR (||) operator.