- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2023 04:22 PM
Within a RP, I have a JSON script that parses populates an html field in a custom table which comes from an MRVS.
I am trying to create a line break and ultimately add a header to the data. Is this possible with the RP script?
var mRow = producer.add_assets;
var mRowObj = JSON.parse(mRow);
var str = '\n';
for (i = 0; i < mRowObj.length; i++) {
str += mRowObj[i].ip + '|' + mRowObj[i].host + '|' + mRowObj[i].ip_description;
if(i != mRowObj.length -1) {
str += ' | ' ;
}
}
current.u_test_htl_data = str;
Current Result
Ultimate Result
This would be the ultimate result but the line breaks would be acceptable, followed by a header, followed by having all within a table
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 09:30 AM
Since this is an HTML field, you'll want to use the <br> tag instead of \n, but since you want it in a table, something more like this would work:
var mRow = producer.add_assets;
var mRowObj = JSON.parse(mRow);
var str = '<table><tbody><tr><td><b>IP</b></td><td><b>Host</b></td><td><b>Desc</b></td></tr>';
for (i = 0; i < mRowObj.length; i++) {
str += '<tr><td>' + mRowObj[i].ip + '</td><td>' + mRowObj[i].host + '</td><td>' + mRowObj[i].ip_description + '</td><tr>';
}
current.u_test_htl_data = str;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2023 09:30 AM
Since this is an HTML field, you'll want to use the <br> tag instead of \n, but since you want it in a table, something more like this would work:
var mRow = producer.add_assets;
var mRowObj = JSON.parse(mRow);
var str = '<table><tbody><tr><td><b>IP</b></td><td><b>Host</b></td><td><b>Desc</b></td></tr>';
for (i = 0; i < mRowObj.length; i++) {
str += '<tr><td>' + mRowObj[i].ip + '</td><td>' + mRowObj[i].host + '</td><td>' + mRowObj[i].ip_description + '</td><tr>';
}
current.u_test_htl_data = str;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2023 10:53 AM
Thank you Brad. This is the solution I used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2023 01:21 PM
You are welcome!