Hi there,
I’m struggling with some data wrangling . . .
I have dates for a number of companies (not every company has the same dates).
And I have a start date that varies by company
What I’m looking for . . .
all dates from the start date get a “1”
and all date older than the start date get a “0”
I’m thinking of doing something with flow variables . . . but I don’t see how
Can anyone get me started?
Many THNX in advance
BREAKOUT_knimeforum_20230802.knwf (17.8 KB)
Hi
have you considered converting start date to a variable and use it in the Datetime difference node to calculate the difference in days. Then sth like rule engine if the difference is positive 1 else 0 ?
br
1 Like
Hi @Daniel_Weikert
yes, I toyed with that idea but in practice I see a huge complexity with the dataset. There are 100+ companies and 100+ different start dates. And that grows every week with new 5 companies and 5 new start dates.
To keep it simple I thought about using the start dates as flow variables. But I don’t see how
With this complexity, would you stick to “start dates as variables” or switch to another approach (e.g. flow variables or looping).
THNX for your suggestions
-SL
I’d say @Daniel_Weikert is on the right track here. Something like this could do the trick:
I opt for an one-node solution using the CE node but that’s personal preference.
if (rowId().equals("START")) {
null
} else if (column("comp1") >= variable("comp1")) {
1
} else {
0
}
If your dataset is that large I think you can’t escape looping and using the flow variables from the loop as input (like CurrentColumn).
WF:
BREAKOUT_knimeforum_20230803 V2.knwf (27.7 KB)
Hope this helps!
2 Likes
Hey @Daniel_Weikert & @ArjenEX
you both thnx for your feedback and now I was able to create the flow I needed.
I slightly adapted my requirements:
if START equals a date it generates the value “9” instead of issing
if a date is missing the end situation gives a missing ("? " )
This to avoid that “equals” and “missing” are mixed.
Just a litte question to @ArjenEX . . .
in the Column Expression node you use “.equals”
if (column(“ColumnValues”).equals (column(“START”)))
I would use “==” but that doesn’t work . . . why ???
if (column(“ColumnValues”) == (column(“START”)))
regards
BREAKOUT_knimeforum_20230806 V3.knwf (27.2 KB)
My recommendation would be to always use equals if you are looking for a particular text string. More details about what’s best to use when:
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
3 Likes
system
Closed
November 4, 2023, 12:34pm
7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.