Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
talendstar
Creator
Creator

multiple html tables in email

I am able to send html based email  that contains one single table via tsendemail. I have another table for record counts that I would like to send in the same email.

 

I have created two mail messages and here is what my tsendemail looks like:

"Results are : \n" + ((String)globalMap.get("mailMessage")) + "\n Record Counts : \n" + ((String)globalMap.get("mailMessage_two"))

 

However the second email message is getting appended to the last cell of the first table instead of a separate table.

 

here is tJavaRow_1:

String msg = ((String)globalMap.getOrDefault("mailMessage", "<TABLE name=b border=1 cellspacing=1px>" + "<TR><TD>STEP</TD><TD>DATETIME</TD></TR>"));
msg = msg + "<TR><TD>" + input_row.Step + "</TD><TD>" + input_row.Timestamp + "</TD></TR>";
globalMap.put("mailMessage", msg);

 

tJavaRow_2:

String msg_two = ((String)globalMap.getOrDefault("mailMessage_two", "<TABLE name=a border=1 cellspacing=1px>" + "<TR><TD>S</TD><TD>D</TD></TR>"));
msg_two = msg_two + "<TR><TD>" + row4.Timestamp + "</TD><TD>" + row4.Label + "</TD></TR>";
globalMap.put("mailMessage_two", msg_two);

 

 

I have attached a screenshot of the flow.0683p000009M4Xw.png

 

Here is the resulting email at the moment:

0683p000009M4bi.png

Any thoughts on how can I get the second table to print out separately?

 

 

Thanks

Labels (3)
1 Solution

Accepted Solutions
talendstar
Creator
Creator
Author

That did not work.

 

However I was able to make it work by adding </Table> within tsendmail message body.

 

"Results are : \n" + ((String)globalMap.get("mailMessage")) + "</TABLE>" + "\n" + "\n" + "Record Counts : \n" + ((String)globalMap.get("mailMessage_two"))

 

Thanks for the idea. It was helpful.

View solution in original post

2 Replies
nfz11
Creator III
Creator III

This is not a Talend question at all but an HTML question, but I will answer it anyway.

 

You need an end table tag after the first message.  You should put one after the second message too for best practice.

 

...
input_row.Timestamp + "</TD></TR></table>";
globalMap.put("mailMessage", msg);
...
msg_two = msg_two + "<TR><TD>" + row4.Timestamp + "</TD><TD>" + row4.Label + "</TD></TR></table>";
...
talendstar
Creator
Creator
Author

That did not work.

 

However I was able to make it work by adding </Table> within tsendmail message body.

 

"Results are : \n" + ((String)globalMap.get("mailMessage")) + "</TABLE>" + "\n" + "\n" + "Record Counts : \n" + ((String)globalMap.get("mailMessage_two"))

 

Thanks for the idea. It was helpful.