I’m trying to implement a worflow using a DateTime range node; I need for example a week of time serie with a 1 hour of spacing.
So I need of a switch case node: I need to loop on this calendar and if the time is from 00:00 to 07:00 I need to set a variable to a value, if the time is in the range 07:00 and 18:00 I need a variable is set to 0, if the time is in 18:00 to 23:00 I need to set another value.
I don’t understand how to set a loop node with a switch case node to set my conditions.
Any help is apreciated.
I do not fully understand your problem. However, I suspect the following nodes might help you (without even needing a loop) to get the hour and assign values based on the hour:
I hope this solves your case, otherwise some example data may help to understand the problem better.
As you can see the image above, I set a variable rows (I don’t know how many rows can be expected). After that, i set the start date/time and at the ending point, i set +1 hour (+1h) ant set the date and time.
When you run it, the node will generate all rows necessary with this interval.
thank you for your suggestion, they drive me to an acceptable solution.
But there are some problems: If I use my nodes it seems they don’t work, so I import the @denisfi workflow and it works correctly. It may be a version problem I’m using Knime 4.7.0. @denisfi can you explain your regex expression?
Another question is: if in the rule engine node the setted values they can be taken from another node, as example a math formula node?
In the pic there is my actual workflow, so i need the rule engine take the values from the 2 math formula nodes.
Thank ypu @denisfi for your clear explanation…do you have any suggestions on how to set rule values by taking those values from a mathematical node formula?
Thanks for your hints.
Math Formula node just make a calc… rule engine test some information using other tools as string manipulation. Can you use the example that I passed before and adapt it to your case?
If you have to split data and the csv information, you can use a joiner node or cell replacer to complete with these variables. Can you send again a complete wf here as example?
I use you example…so I have modified rules adding an extract datetime node and it works fine.
I attached my workwflow…if you see in the rules, I have the values 10 and 100 and I want the value100 is PMax and 10 is the value Prid, PMAx and Prid are caluclated with the 2 math formula nodes.
I don’t understand the match from each line, but as you can see from this new workflow, you can set and calc using a regular math formula, not the multicolumns because this options will apply the same calc for multiples columns to make it quick calc for all cases. Using the simple math formula, I can put the Pmax and the Prid at the same single line.
Not what do you need to do with the time to match with the calc? just a merge/joiner?
Great work! With the row with CSV reader I have the 2 variables: PMax and Prid, so this I want is:
if the time is in 0 to 6, the condition is equal to Prid, if time is 7 the value must be Pmax, if the time is in 8-18 the value is 0, and in the end if time is in 18-23 the value is PMax.
I hope now it is clear what I expect.
Thanks.