- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 03:34 PM
Hi folks,
Currently my array prints like this
using this statement..
template.print(newRes.toString().split('<br />'));
I need to have it printed in a column, separated by a newline, like this...
Brian Forbes
Chhorda Rorth
etc
Is it possible to do this?
Thanks,
Rob
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 05:28 PM
try changing
template.print(newRes.toString().split('<br />'));
to
template.print(newRes.toString().split(',').join('<br />'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 03:49 PM
Assuming you replace headers and field names with the ones you want, something to the effect of...
var myhtml="<html><body><table><th>Configuration Item</th><th> u_environment</th><th> u_affected_business_units </th><th> u_lifecycle_state </th><tr>";
for(i=0;i<arr.length;i++) {
switch(i) {
case 0: {
myhtml = myhtml + "<td>"+arr[i].configuration_item+"</td><td>"+arr[i].state+"</td>";
break;
}
case 1:{
myhtml = myhtml + "<td>"+arr[i].state+"</td>";
break;
}
case 2: {
myhtml = myhtml + "<td>"+arr[i].state+"</td>";
break;
}
}
}
myhtml = myhtml+"</tr></table></body></html>";
template.print(myhtml);
Please ✅ Correct if this solves your issue and/or 👍 if Helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 05:28 PM
try changing
template.print(newRes.toString().split('<br />'));
to
template.print(newRes.toString().split(',').join('<br />'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 07:33 PM
THank you both for all of your guidance with this solution. Your generosity with all your knowledge and expertise is an inspiration.
THank you!