How to print each array element in new line

imran sk
Tera Contributor

Hello experts,

 

I'm querying to sys_approver table and collecting all the approver comments for that particular RITM.

I'm going while loop and adding all comments to array. I'm getting the values in comma separated values which is like paragraph. Instead of getting comments in paragraph I need each comment in new line

How to print each Array element ( comments) in new line 

 

 

Need suggestions here. Thanks in advance ☺️ 

8 REPLIES 8

This works in Background script 

But im passing the values in HTML type of field 

OK.  You are not showing what you are doing, so I don't see why this wouldn't work.  You have one string of comments with a date/time/user header, then a new line, then the comment, then two new lines, and it repeats, so split into an array on '\n' and get the elements you want into a HTML field or whatever.

Use the script posted before that adds the \n\r,.and instead of adding \n or \n\r just add <br /> for a new line.

Hi Imran, 

Would you try replacing it with "\n" to "<br>" as you are saying it is of HTML field type.

Please mark helpful, it it works for you.

 

Thanks,

Suman.