Add a column saying if another column is empty or not

Dear All,

situation as followed:
There are two columns “Tax Registration No 1” (TRN1) and “Tax Registration No 2” (TRN2). I’ve to pivot (i.e., total up) “Tax Amount” depending on if No 1 or No 2 is not empty (i.e., not null and len(trim(TRNx)) > 0) and two other criteria.

My current approach is, to add a boolean-column “TRN known”.

My questions are:
(a) what node should I use to accomplish above described challenge
(b) any suggestions out there to solve it in a more elegant way

Thanks in advance and kind regards,

Patrick

Hi @Patrick1974 -

Your approach is similar to what I would do. I would make a new boolean variable using the Java Snippet node, defined by the criteria you mentioned. (You might be able to use the Rule Engine node here too, but it’s a little less flexible.) Then I would use a GroupBy node to sum the Tax Amount over values of the new boolean variable.

There very well could be a more elegant way to approach this though!

Hey @ScottF,

I finally managed to get a Java Snippet running - and it does the trick.
Last time I did developing for bread winning, I worked on IBM Mainframes doing Assembler and COBOL… was quite a challenge to dive into Java but I managed it.

Thanks for your swift response and have a nice day,

Patrick.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.