Node to manipulate execution time of a query node

Hi All,
I have got 2 queries in 2 DB query nodes in my 1 workflow.
I want 1 of the query to run on daily basis and 2nd query to run on Friday on Weekly basis. This workflow will placed on server to run daily, Is there any logic which i add to make sure only 1 of them run on daily basis and another query runs on weekly basis on Friday.
I dont want to create 2 workflows for this.
thanks for the helpa
Thank,
Raman

Hello @rds,

I would rather put this logic inside a query than KNIME. This shouldn’t be too complicated with SQL. If it’s Friday run your query and if not return empty table. This way in KNIME you simply need Empty Table Switch node after DB (Query) Reader node. However if you want this logic in KNIME you have to get execution date, from that extract weekday number/name and then there are multiple ways. For example some If/Case switch that will stop query node from executing.

Br,
Ivan

6 Likes

Hi @rds,

If you make a “call a workflow” node, you can pick the date for today from : “Create date&time range node” or “Date&time Imput (legacy) node” to find the “today” execution date&time. After that, you can use “Extract Date&time” node looking for week number or name and save it as a flow variable.

Date&time Input

Create Date&time range

The date must be a date format, so I convert it using string to date&time node.

Extract Date&time

Use it to extract some information from date fields (day, month, year, names, hours…) I set Day of week (number) to make a easier way to compare.

You can use a rule engine node to set if is flow “A” or “B” comparing numbers as:

“Day of week (number)” = (1 OR 2 OR 3) => “A”
“Day of week (number)” = (4 OR 5 OR 6 OR 7) => “B”

With it, set as flow variables and use it inside the dababse sql script as @ipazin said and you don’t need to lost time with sql scripts.

I hope that it’s helped you.

BR,

Denis

2 Likes

Thanks @ipazin that was a great suggestion, it ade life suddenly very easy.
Appreciate it .

3 Likes

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