How to combine conditions between dates?

Hi!!

I’m trying to replicate an Alteryx conditional formula to Knime with the Rule Engine node.
Could you guys help me ?

IF [MONTH_BEG_DATE]>=[LFL_START_DATE]
AND
[MONTH_BEG_DATE] < DateTimeAdd([LFL_END_DATE],-30,‘days’) THEN
‘LFL’
ELSE
‘n_LFL’
ENDIF

All the columns are Date format

Thanks!

Please see this discussion

Also, look at

3 Likes

Hi @hdelfis-crf,

can you please provide more information? Do you have just one table with two date columns where, if the conditions are met, a certain column should been given back? Sample data always helps to better understand the intention, purpose and desired outcome.

Cheers
Mike

Hi mw,

Sorry about that!
Follow the attachment with the example, the result is the last column, where I can define if the flag is “LFL” or “n_LFL”

Hope it helps

cheers

example.xlsx (22.5 KB)

Hi there,

no worries. I think you’ve got to divide the challenge into:

  1. Convert string to date (if not in date time format already) via String to Date&Time
  2. Calculate time difference “DateTimeAdd([LFL_END_DATE],-30,‘days’)” via Date&Time Shift
  3. Use rule engine

Here’s the solution :wink: Since the Excel reader automatically converts the dates I spared step #1.

https://hub.knime.com/mw/spaces/Public/latest/Knime%20Forum%20Support/Rule%20engine%20with%20dates

Cheers
Mike

2 Likes

Mike, fantastic!!

Thank you so much!!

cheers :metal:

1 Like

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