I am thinking of having two loops (Table Row to Variable Loop) to send emails:
1st Loop is to pull email address and send emails to multiple recipients from the table of email address list . Example of the email list table like below:
2nd Loop is to insert the HTML table based on the same email recipient as in the first Loop, and to add this HTML table in email body. Example of the HTML Table will be like below:
Name
Region
Sales
Andy B.
South
1000
Andy B.
North
2000
Andy B.
East
3000
Andy B.
West
4000
Jack O.
South
1500
Jack O.
North
2100
Jack O.
East
3500
Jack O.
West
2800
Wesley K.
South
9800
Wesley K.
North
1800
Wesley K.
East
6600
Wesley K.
West
3900
So what I want the loops to do is to have separate emails for Andy, Jack and Wesley with the summary of their respective sales by region, eg. Andy:
Name
Region
Sales
Andy B.
South
1000
Andy B.
North
2000
Andy B.
East
3000
Andy B.
West
4000
I tried to merge variables, however, not successful, probably due to the different types (tables in Loop #1 vs. HTML in Loop #2).
Below flow is what I’ve tried also, but not successful:
Hi @xaviersun and welcome back to the KNIME Forum,
You don’t need 2 loops, one is enough. The loop start node at the top flow is OK. After this node (Node 47) you have a name and an email address as flow variables. So after the bottom Column Filter node and before using the Table to HTML node, place a Row Filter node and connect the output port of the loop start to this node then filter rows based on the Name column by using the “Name” flow variable produced by the loop start node as the pattern. Now instead of another loop start node, use the Table Row to Variable node, configure the Send Email node and close the loop.
Hi @armingrudd sorry just one more question - I created a donut chart that I also want to add as attachment into the email together with the HTML table via Table Row to Variable. Not sure if that’s because of the conflict, it won’t be able to generate the URL although I did put in the output path and enabled the overwrite in the Image Writer node.
In the configuration window of the Image Writer (Port) node, go to the Flow Variables tab and input some variable name for the “file_out_path” in text box, so the file path is saved as a variable and you can use it in Send Email node.
Hi @armingrudd I changed to use Create Temp Dir node to replace my local path as I need to let Knime server execute the workflow. So I used the path variable created in Create Temp Dir in Image Writer (Port) node, and I did check Overwrite OK. However, when it ran in the Knime server, it failed with the error WARNING Image Writer (Port) 14:143: Output file 'xxxx(temp file path)' exists and will be overwritten. Does that mean knime server doesn’t support overwrite function for this node since I am using the Create Temp Dir? Have you ever experienced this?
That’s a warning not an error. It’s alright to run the flow.
If the job on server has failed (red sign), please provide all the messages. Maybe there is another issue.
you right it is the warming and actually the job was partially execute. There is no red sign of ERROR, and that warming msg is the only one I can see. I guess I need to find out from Knime what triggered the execution. I ran in local Knime app and it worked perfectly. so not sure what blocked that. Quite odd.