Hi All,
I am quite new to this community, having an issue processing a report whose column might differ on every run. For example:
Col A | Col B | Col C |
ABC | DEF | GHI |
Sometimes all three columns exist, or sometimes only column B exists, etc.
I'd like to create a new column with the following logic:
IF (col A exists) THEN [col A]
ELSEIF (col B exists) THEN [col B]
ELSEIF (col C exists) THEN [col C]
ELSE null( )
ENDIF
For example, if only Col B & Col C exists, the value taken should be from Col B. How would this be possible? Thanks for your help!
Solved! Go to Solution.
@nbryanrh
I think we need to "force" all the column to be present even when they are not. 😀
I created another input file which contains only all the columns then do a union/
Hello @Qiu I have a similar query.
Your solution works only when either all three are present or all three are not present.
If Col A and Col B are present and only Col C is not present, then this does not works, since the union will create a new row instead of adding a null field in the same row.
Can you please help me understand on what to do in such a scenario?
I have added a sample workflow for your reference.
Thanks.
@Gandalf_NotGrey
There are 2 minor points you have missed out in your sample flow. Check below snaoshot with comment.
Thanks @Qiu - Keeping the empty row was wrong, removing it made the workflow work.