Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm facing a problem with creating a customized table in the email part of my data alert. I want to get the row counts of two tables in different servers and generate a table basically looks like the picture below.
But I only received an email with a bunch of code in my email:
<HTML><HEAD><style type="text/css">.TFtable{width:100%; border-collapse:collapse; }.TFtable td{ padding:7px; border:# 4e95f4 1px solid; width:10%; text-align: center;}.TFtable tr{ background:# b8d1f3; width:100%; }.TFtable tr:nth-child(odd){ background: # FFFF;}.TFtable tr:nth-child(even){ background: # 8080ff; }.TFtable th{background: # 00001a;width:15%; text-align: center; padding;25%; color: white;}</style></HEAD><BODY><h3 style='text-align:center;'>Table</h3><table class="TFtable"><tr><th>Table1</th> <th>Count1</th><th>Table2</th><th>Count2</th><tr><tr><td>abc</td><td>123</td><td>def</td><td>456</td></tr></table>
My data pipeline looks like this:
The code in tJava_1:
globalMap.put("v_DetailedReport" , globalMap.get("v_DetailedReport").toString()+
"
<HTML><HEAD><style type="text/css">.TFtable{width:100%; border-collapse:collapse; }.TFtable td{ padding:7px; border:# 4e95f4 1px solid; width:10%; text-align: center;}.TFtable tr{ background:# b8d1f3; width:100%; }.TFtable tr:nth-child(odd){ background: # FFFF;}.TFtable tr:nth-child(even){ background: # 8080ff; }.TFtable th{background: # 00001a;width:15%; text-align: center; padding;25%; color: white;}</style></HEAD><BODY><h3 style='text-align:center;'>Table</h3><table class="TFtable"><tr><th>Table1</th> <th>Count1</th><th>Table2</th><th>Count2</th><tr>
");
tJava_2:
globalMap.put("v_DetailedReport" , globalMap.get("v_DetailedReport").toString()
+"<tr><td>"+globalMap.get("A").toString()
+"</td><td>"+globalMap.get("B").toString()
+"</td><td>"+globalMap.get("C").toString()
+"</td><td>"+globalMap.get("D").toString()
+"</td></tr>");
tJava_3:
globalMap.put("v_DetailedReport" ,
globalMap.get("v_DetailedReport").toString()+"</table>");
PS: A,B,C,D are the columns generated by the db input.
Anyone can help to debug this? Not sure the code doesn't map to a table. Thank you!
Hi @Xiaoshan You,
By the Resulting HTML code you sent, this is what you can expect to get in your email:
To validate the html you have a lot of options I just used https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default
And on your tSendMail got to Advanced Settings and change it from Plan Text to HTML
I hope that helps you
Cheers