Hi KNIME expart
I’m looking for how to identify data in specific date.
would like to pick up data which is applicable to condition
Example Condition: “Apple from Mar1 to Mar10” .
No.1 Banana from Mar10 to Mar12
No.2 Apple from Feb27 to Mar5
No.3 Apple from Feb1 to Feb20
No.4 Apple from Mar8 to Mar20
No.5 Apple from Mar20 to Mar31
Pick up data : No.2 and No.4
Is there any node to recognize them? I would appreciate your help.
is this how your data looks like? All information in one column? And about your condition - does it also has to be one string like in your example or you can have three inputs like Apple, Mar1 and Mar10?
Thank you for your reply. Actually data are in each column.
Banana | Mar10 | Mar12
Apple | Feb27 |Mar5
Apple | Feb1 | Feb20
Apple | Mar8 | Mar20
And condition data is also in column and in different sheet.
hi @erisu, I gather you are trying to find where there is an overlap of your dates. As you have no years on the dates, what happens at the end/start of the year. Would you have rows such as
Apple | Dec27 |Jan5
and would you potentially have conditions such as this?
Is it assumed that your date ranges would only ever be across, say, about 30 days at most? Put another way, can we say that for a given date range, the From-Date will always be either the month-prior-to or the same-month as to To-Date?
Actually, date have year as well and range is mostly 2-3 weeks.
Now I have realized what I wanted to do is different.
And I would like to pick up only “1)Apple |2021/03/01” data.
Sorry for making confusion.
@erisu Thanks for the clarification. That very much simplifies the problem.
To compare if two date ranges A1-A2 and B1-B2 overlap, the generalised rule is that an overlap exists if, and only if, the following is true:
A1<=B2 AND A2>=B1
Next question then, does your condition only ever exist of one row?
Based on my understanding so far, does this workflow assist? The first few nodes are just setting up the sample data, so of course you may already have this in a different form…
KNIME_filter_date_condition.knwf (26.3 KB)
It assumes there would be only a single condition row. If there were more, then some de-duplication of resultant rows might be required, or some other efficiency tweaks if there were a very large number of condition rows and data rows, since the cross-join will result in the product of all rows from both data sets.
glad you realized what you need but still don’t think it’s clear to others (or at least to me) how your input data looks like and is there one condition or multiple conditions, are borders included or excluded and do years play a role… If possible I suggest to share (dummy) data input and desired output so you can get proper ideas/suggestions/solutions
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.