The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to Split a Value that is in a Multi line Text field into new lines

ursnani
Giga Guru

Hi,

I am fetching a value through a webservice ('parametes') which is "{"FirstName":"Rob","LastName":"Civitello","ID":"XXXXXX","Location":"XXXXXX"}". I want to split this value and display it in Mutli Line text field as follows

FirstName:Rob

LastName:Civitello

ID:XXXXXXX
Location:XXXXXXXXX.

Can some Please help me in spliting these and dispalying as mentioned.

Thanks,

6 REPLIES 6

Shishir Srivast
Mega Sage

Please use \n to get the string in next line.


I am fetching that value a single string and i want to split by , and then remove the Quotes and then display as show.


Please check if this helps.



var obj = JSON.parse('{"FirstName":"Rob", "LastName":"Civitello", "ID":"XXXXXX", "Location":"XXXXXX"}');


gs.print('FirstName' + ':' +obj.FirstName);


gs.print('LastName' + ':' +obj.LastName);


gs.print('ID' + ':' +obj.ID);


gs.print('Location' + ':' +obj.Location);


Yes this is Working fine, but one more questions.



Can we keep this value in a Multi lie text like what we are getting.


and these values will be dynamically changing we might not get the Same name all   the time.