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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Html table alternative rows for tSendEmail

Hi,

I made a report which will be send through email, everything is working fine. The one small issue is design of html, below is my tJavaRow code, So for each alternative row i want to use different CSS class. 

I have two classes class='tg-yw4l' and class='tg-6k2t'. How can i do this, Please advise.

 

 

 

msg = msg+
 "<tr>" +
 "<td class='tg-6k2t'>" + input_row.Registeration_Date +  "</td>" +
 "<td class='tg-6k2t'>" + input_row.Outgoing_revenues + "</td>" +
 "<td class='tg-6k2t'>" + input_row.RGE + "</td>" +
 "<td class='tg-6k2t'>" + input_row.First_Recharge + "</td>" +
 "<td class='tg-6k2t'>" + input_row.ARPU + "</td>" +
 "</tr>";

 

 

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

As I understand, you search for a solution to apply 1 css class for odd rows and an other for even rows.
You may use a sequence to decide which css class must be used for the current row and store the name into a local String variable:

String cssClass;
if ((Numeric.sequence("s1",1,1) % 2) == 0)
cssClass = "tg-yw4l" ;
else
cssClass = "tg-6k2t" ;

Then you can use the cssClass variable when you construct the msg variable:
"<td class='"+cssClass+"'>" + input_row...

View solution in original post

4 Replies
TRF
Champion II
Champion II

As I understand, you search for a solution to apply 1 css class for odd rows and an other for even rows.
You may use a sequence to decide which css class must be used for the current row and store the name into a local String variable:

String cssClass;
if ((Numeric.sequence("s1",1,1) % 2) == 0)
cssClass = "tg-yw4l" ;
else
cssClass = "tg-6k2t" ;

Then you can use the cssClass variable when you construct the msg variable:
"<td class='"+cssClass+"'>" + input_row...
Anonymous
Not applicable
Author

Thank You, It works perfect.

somersst
Contributor III
Contributor III

Hi,

 

where have you defined the style of the class itself??

 

Can you provide me Message-part of the tSendMail component

Anonymous
Not applicable
Author

Hi,

 

Final Job design;
0683p000009M3s6.jpg

 

 

 

 

 

 

 

 

tJavaRow:

String msg = ((String)globalMap.getOrDefault("mailMsg",
"<table><tr><th>Column_1</th><th>Column_2</th><th>Column_3</th></tr>"));
msg = msg +
 "<tr>" +
 "<td>" + input_row.Column_1+ "</td>" +
 "<td>" + input_row.Column_2+ "</td>" +
 "<td>" + input_row.Column_3+ "</td>" +
 "</tr>";

globalMap.put("mailMsg", msg);

tSendEmail:

"Daily Report: "+
((String)globalMap.get("mailMsg")) + 
"</table>"