Flag based on date intervals

Hi community,

I would like to create a flag (Y/N) in a new column if the value in the date attribute “LastPurchaseDate” is after a set date eg: if “LastPurchaseDate” is after 2011-09-11, then Yes, else No.

I have tried using the Rule Engine node with this statement “$LastPurchaseDate$ > 2011-11-09 => “Y”” but just gives me errors.

Any suggestions?
Thanks for the help!

I tried using the Rule Engine node and it worked for me. Note the quotation marks in the rule.
There is no documentation in the node description on the accepted format. I also noted some strangeness in that the Rule list disappeared when I opened the dialog a second time (then reappeared when I opened a third time - using KNIME 3.6.0 on windows).

A (better IMHO) alternative is to use the Date and Time Difference node to calculate the difference between the LastPurchaseDate values and 2011-11-09 (see config screenshot below), followed by a Rule Engine node to convert negative values to “Y”.

Hope this helps


Thanks Don, I tried the Rule Manager with the string you showed in the screenshot and this worked well and solved my issue. Just a quick follow-up question - how do I add an ‘else’ in the statement so that all the rows which does not meet the criteria has the flag 'N" instead of blank or red '?"?

Thanks again for the help with this.

Just add a line at the bottom with: TRUE => "N"

1 Like

Perfect, thanks, that did the trick. Thanks again for your help.

A follow-up question, what if I want to make a rule on specific days?