Hello everyone,
I already have my work calendar and I want to get the day before the current work day (no days off). I want to use this date as a filter to filter out the number of orders for this date.But I don’t know how to automate this process without having to manually filter dates.
Although you say “no days off”, do you mean “no weekdays off”. Presumably you are wanting the day before the current work day as it appears on the calendar in your first screenshot? So, if for example today is 2021-01-18 (Monday) then you would want it to return 2021-01-15 (Friday), or am I wrong? I presume this is why you showed the calendar screenshot?
And by current day, do you mean current system date, or will you tell it (e.g. by an input widget/node) what “current day” is?
Hi @takbb ,
Nice to see you again.
“no days off” is mean Saturday and Sunday are not included, I try use Date& Time shift node, but this node can not get rid of Saturday and Sunday.
And by current day is mean current system date, I use Create Date&Time Range node.
I don’t know if there is a “single node” solution, to this, but the following might help with getting the previous week day, using a small piece of java to set the value to subtract (-1,-2,-3) according to current day name
Find previous week day.knwf (14.4 KB)
[edit: just re-uploaded so that final node creates new column rather than having it still called just “today” after subtraction]
Does that work for you? Did you need assistance with other parts of your problem?
(You can then presumably just do a Join on the “today-previous-day” column output by the above, and “inner join” that to your other table using
Hi @takbb ,
I am so sorry I didn’t explain myself clearly.
The today-previous-day has to be sorted by my work calendar. Because my work calender has eliminated holidays and added weekdays that require work on weekends(Because of the special nature of my country, some of them need to work on weekends).
For example, The day before 2021-2-8 is 2021-2-7, not 2021-2-5.
I create this workflow for work calender, and use Cell Replacer node corresponds to the date of the previous day, and then use Reference Row Filter node filter through this node to get the number of orders for this date. But the previous day’s setup I never found a way.
Hi @Banksy, no problem, and my bad as I only quickly scanned the supplied work calendar half way and didn’t pick up on what you were saying.
Anyway, so the problem definition, if I now have this correct is this:
For a given work calendar, find the latest date that is not greater than the day before current date (i.e. not greater than yesterday)
If I define it that way, then what we can do is find yesterday’s date, and use that as a “max” cut-off for the dates in your calendar. Once you have done that, the maximum date remaining in your calendar is the last working day before today…
That’s what I need, you are so smart. I also know these nodes, but I don’t have the same idea as you.
And I’m new to using variables,no understanding of the rules for using variables. I get the feeling that you know every point. How do you do that?
Thanks for your kind words @Banksy. There are many people on the forum who know KNIME a lot better than I do, and I am learning from other solutions all the time. According to my forum stats, I have now been visiting the forum for 97 days, which still makes me a relative newcomer to this great tool, and it means that 98 days ago I had not even heard of KNIME! I’ve had the luxury of being able to spend each of those days reading and learning as well as trying to solve problems, and the community here is just awesome.
I would definitely try to learn more about flow variables though if I were you, as there are some things that are difficult or impossible to achieve without them. And… If there is something you don’t understand, you know where to go to ask…
My master @takbb ,you are always so kind to help me. I am very grteful to you. I guess I still know too little about nodes to simply use them. I don’t know the existence of a node that I haven’t used yet and what does it do. And this forum uses a great platform for people who need help and learning.