Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi ,
I am trying displaying infotable field values in html table as email content or body.but it not taking as variable? can anyone help me for this query? below is code for displaying html content. its printing rowValue1 , rowValue2 as it is. I want their actual values .
var result = me.getDataForWeek(); //infotable result
var tableLength = result.rows.length;
logger.warn(tableLength);
for (var x=0; x < tableLength; x++) {
var row = result.rows[x];
logger.warn(row.M_Key);
var rowvalue1= row.M_Key;
var rowvalue2 =row.PowerFactor;
var emailContent = "<html><body>\
<table>\
<tr><td>M_Key</td><td>Powerfactor</td></tr>\
<tr><td>rowvalue1</td><td>rowvalue2</td></tr>\
</table></body></html>"
}
Thank you
Solved! Go to Solution.
// i haven't tested it at my end
but couple of things you can try at your end
1. try using + operator between the variable value like
<tr><td>+rowvalue1+</td><td>+rowvalue2+</td></tr>\
2. try assigning Ids to your cells like
<td id="rowvalue1">rowvalue1</td>
<td id="rowvalue2">rowvalue2</td>
and then set their values in javascript like
document.getElementById("rowvalue1").innerHTML = rowvalue1;
document.getElementById("rowvalue2").innerHTML = rowvalue2;
Hi,
You are overwriting emailContent and the result is a html for the last object in the infotable.
Can you share what result you are getting?
Thanks,
Raluca Edu
// i haven't tested it at my end
but couple of things you can try at your end
1. try using + operator between the variable value like
<tr><td>+rowvalue1+</td><td>+rowvalue2+</td></tr>\
2. try assigning Ids to your cells like
<td id="rowvalue1">rowvalue1</td>
<td id="rowvalue2">rowvalue2</td>
and then set their values in javascript like
document.getElementById("rowvalue1").innerHTML = rowvalue1;
document.getElementById("rowvalue2").innerHTML = rowvalue2;
Hi rosharma,
Thank you for your response. tried first approach given by you , it worked . actually we need to put variables like, " +var1+" with double quote.
Thank you
Hi raluca_edu,
yes correct , I am getting only one infotable object that is last row data instead It should get multiple row data while iterating in html table. anything went wrong myside?
Thank you