0
votes

I am trying to add some logic to my expression table (exp_source). Basically, if the field o_field_digital__c is 'Yes' then change it to 'Y'. If its 'No' then change it to 'N' and if it's Null then just leave it blank. I put in the following and its showing syntax error

IIF(o_Field_DRC_Choice_Eligible__c = 'Yes', 'Y')
IIF(o_Field_DRC_Choice_Eligible__c = 'No', 'N')

Can you please fix this? Do I only need one IIF statement? this obviously has syntax errors

2

2 Answers

1
votes

First you need to understand it is a transformation not a table.

Second, you can't change the value of an input port - you can only create a new calculated variable or output port

Last... IIF syntax is IIF(condition, return true, return false)

As you can see you haven't provided a value for the return false argument which ironically is where you should have nested the subsequent IIF. Also you will have to specify to otherwise leave blank in the missing return part of the nested IIF.

to correct you will need to nest them so

IIF(o_Field_DRC_Choice_Eligible__c = 'Yes', 'Y', IIF(o_Field_DRC_Choice_Eligible__c = 'No', 'N', '')) 
0
votes

You can use the below logic for the purpose, if none of the condition is matched it will default the output to blank:

DECODE(true,
o_Field_DRC_Choice_Eligible__c = 'Yes','Y',
o_Field_DRC_Choice_Eligible__c = 'No', 'N',
ISNULL(o_Field_DRC_Choice_Eligible__c),'',
'')