cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Html content( data getting from Infotable) using TWX email

VaibhavShinde
16-Pearl

Html content( data getting from Infotable) using TWX email

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

ACCEPTED SOLUTION

Accepted Solutions

// 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;

 

View solution in original post

5 REPLIES 5

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

Hi,

What i have put in td tag same i am getting in result, but i want variable values.
When i take variable into logger.warn its printing correct values, but when i put those variables in html table tags its printing variable names instead their values.

Thank you

// 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

Announcements


Top Tags