Nested If statement

Hello, dear Knimers :innocent:

Is it possible to have nested rule engine?

if(“Time Bucket RDD”=‘Current Month’,‘Current_Month’,
if(“Time Bucket RDD”=‘Future’,‘Future’,
‘PastDue’)) as Time_Bucket_New

Here I created two rule engine node, but I think the rule engine node supports nested functions as well

First If statement

Second If statement

Thanks in advance :relaxed:

1 Like

Hi @Karlygash

Nice to hear from you. Yes, you can have many different conditions in different lines. The rule is just that “the first to be TRUE” is the one that “provides the answer”.

In your case the rules to write in the “rule Engine” node would be:

$Time Bucket RDD$ = “Current Month” => “Current_Month”
$Time Bucket RDD$ = “Future” => “Future”
TRUE => “PastDue”

Another way of writting this would be:

($Time Bucket RDD$ = “Current Month”) OR ($Time Bucket RDD$ = “Future”) => $Time Bucket RDD$
TRUE => “PastDue”

Is this what you are looking for ? Otherwise please let us know.

Best wishes :smile:



thanks a lot)) logically yeah, thats right one=) :innocent: :blush:


My pleasure @Karlygash :wink:!


Hi @Karlygash , you can also use the IN statement if you are checking for multiple values for the same column, like this:

$Time Bucket RDD$ IN ("Current Month", "Future") => $Time Bucket RDD$
TRUE => "PastDue"

It’s a bit more elegant and less bulky


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