Automatize date

Hello Knimers.

Im working in a project to automatize emails. I have an idea to do it using loops and incrementing the day of the month, but I don´t get how can I connect the loops or increment the date time.

Does everyone would be so kindly to help me in this task?

Best Regards

N

Hi @ttsk8der

Within a loop, I’d say the easiest method is to use the today() function.

1 Like

Good morning @ArjenEX

Please can you tell me in what extension pack can I find the “Column Expressions” node. I can´t find it in the basic nodes folder.

br
N

Hi @ttsk8der , you’ll find it in the “KNIME Expressions” extension, but if you drag the icon from the link below onto a workflow, it should sort out the installation for you. There is also a “Variable Expressions” node too within that extension.

2 Likes

@takbb Thank you so much I finally found it.

Can you give some example of how to use the node in this context? This is my first time using an extension node.

br

N

Hi @ttsk8der , can you give a little more information about what you are wanting to do, and what “incrementing of date time” you are trying to achieve. thanks

Hi @takbb sure.

Im trying to automatize the “email send” node, to send daily emails. Im trying to do this incrementing the day automatically.

I’ve been trying with loops, formulas but I don´t get how to do it.

br

N

Hi @ttsk8der , so do you have a constantly running workflow with some kind of delay, and it sends one or more emails each day, and each time it does that, you want it to get the current date?

Hi @takbb .
that delay are the 24 hours. About increment the date it´s because I think it can be used as an iterator to send the email daily.

Right now I´m testing this workflow and I just need send it to one email addres. But in future the idea is to send it to more email adresses.

I’m still not quite understanding @ttsk8der.

If you want the current date for the email, then I don’t see a need to use the loop increment. You would on each iteration fetch the current date without having to perform any kind of calculation. Is there some other reason for needing to use the increment?

If you want the current date so that you can include this somewhere in the email, you could use @ArjenEX 's suggestion to use Column Expressions and have it returned into a column, or use the same function in Variable Expressions and have it returned as a flow variable.

Alternatively, the Create Date&Time Range node can be configured to return the datetime, date or time, at execution so it is another possibility. I even have some home-grown date components:

So getting the current date should not be a problem :wink:

So where is it that you are stuck? Do you have a basic workflow at the moment that you can show us, or is it the wider issue of building the whole loop that you are having difficulty with?

The following screenshot is just a mock-up and not a suggestion that this is how a production “email sender” would work, but in its basic form, a loop could look something like this:

1 Like

Hi.

I just had another idea and yes, I don´t see for what I need date as a loop iterator.

I´m going to show you an example I have. The idea is to read and process a file, then send it as an email automatically.

Recently I discover the “wait” node and now I have more questions.
How can I restart the wait daily (for send an email)?
Is this node the best to send daily emails, or I need loops?

Sorry if I´m being too annoying, I’m learning this by my self for the company and I´m getting confused.

br

N
image

Hi @ttsk9der I added (late) to my previous post a mock-up of a loop which you may not have seen. Here is a slightly refined version. Again it’s just to give an idea of how it might hang together rather than as an actual demonstration

In terms of executing in a loop, this kind of works if you have a dedicated machine that is permanently on and you can just leave running. It’s perhaps not the most efficient mechanism from a resources/energy perspective but it would do the job. Alternatives to this are to run the workflow once per day using a task scheduler (also requiring a dedicated /always on machine), and of course it would be wrong of me not to mention that KNIME do have a commercial (paid for) solution (KNIME Business Hub) that has scheduling facilities, so that would be the better option if your company is in a position to purchase one.

Not a problem continuing to ask questions. It’s sometimes difficult to provide answers until more of the problem has been expanded upon. I hope you manage to get past the “confused stage” :wink:

2 Likes

Whoa.
I didn´t expect that the machine needs to be on 24/7, The best solution I see right know is to configure the workflow to execute it in one click :dash:

I´m going to mark the post as solved, because I learn two ways to get current date time thanks to @ArjenEX function and of course, your nodes @takbb .

Thanks for your time @takbb . :v:

Best Regards

N

1 Like

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