Skip to main content
gautams4173
December 27, 2022
Solved

Dynamic Table Population

  • December 27, 2022
  • 3 replies
  • 0 views

Hi,

I am doing a process model where in I am mailing a person a table of contents.

Now the contents are dynamic, and I need to populate the contents from the process variable. I am aware about the  " ### " syntax, but not quite sure how to display multiple rows in a table. Can anyone please help me in this. 

 

Also, While reading community, I read about the ncolumntables function, but its been discontinued now. If there is a replacement for the same please suggest.

Best answer by bhaskaru1784

Use the HTML template for Email smart service. and manually form the html table data in an expression rule. supply expression rule output as input for the ### place holder(tableBody in the below example). Hopefully this should address your requirement.

Below is the sample HTML template.

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<table style="width:100%">
###tableBody###
</table>
</body>
</html>

Sample expression Rule: 

a!localVariables(
local!dataDict: {
a!map(firstName: "abc", lastName: "qwe", age: 23),
a!map(
firstName: "qqqq",
lastName: "ppppp",
age: 29
),
a!map(
firstName: "wwww",
lastName: "vvvvv",
age: 39
)
},
local!tableBody: "<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>" & char(10) & joinarray(
a!forEach(
items: local!dataDict,
expression: concat(
"<tr><td>",
fv!item.firstName,
"</td><td>",
fv!item.lastName,
"</td><td>",
fv!item.age,
"</td></tr>",
char(10)
)
),
""
),
local!tableBody
)

3 replies

New Participant
December 27, 2022

Use the HTML template for Email smart service. and manually form the html table data in an expression rule. supply expression rule output as input for the ### place holder(tableBody in the below example). Hopefully this should address your requirement.

Below is the sample HTML template.

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<table style="width:100%">
###tableBody###
</table>
</body>
</html>

Sample expression Rule: 

a!localVariables(
local!dataDict: {
a!map(firstName: "abc", lastName: "qwe", age: 23),
a!map(
firstName: "qqqq",
lastName: "ppppp",
age: 29
),
a!map(
firstName: "wwww",
lastName: "vvvvv",
age: 39
)
},
local!tableBody: "<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>" & char(10) & joinarray(
a!forEach(
items: local!dataDict,
expression: concat(
"<tr><td>",
fv!item.firstName,
"</td><td>",
fv!item.lastName,
"</td><td>",
fv!item.age,
"</td></tr>",
char(10)
)
),
""
),
local!tableBody
)

gautams4173
December 27, 2022

Thanks, Ill try this