How to split Comma separated values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 12:44 AM
Hi All,
I am returning multiple location values under each country like below which has comma
Country A - av, mexico
Country A - abo,vig,abanaro
I need to get these locations when a specific country is selected and display only those locations.
As the locations include comma(,) how do I split and display
I am able to get the values like av, mexico,abo,vig,abanaro in the logs
but how do I set it in the locations field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 01:30 AM
Hey Please use this code in order to split the values on the basis of comma.
var arr=['a,b,c,d,e', 't'];
var separate=arr.split(',');
gs.log(separate);
in order to iterate you can use the length function.
If you get it, then please mark it as helpful.