String array in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2024 02:51 AM
Hi ,
I am working flow designer , i have declared one string type flow variable. it has values separated by comma.
like var v= 'str,pqr,atf';
i want to runfor loop to iterate this values. Anybody can help here ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 06:04 AM
Hi arjun0101 ,
You can use the .split() method to separate the string and convert it into an array, making it easier to apply a loop with the array.Try with following code.
var v = 'str,pqr,atf';
// Split the string into an array using the comma as a delimiter
var valuesArray = v.split(',');
// Iterate over the array using a for loop
for (var i = 0; i < valuesArray.length; i++) {
// Access each value using the index
var value = valuesArray[i];
// Do something with the value (e.g., log it)
gs.info('Value: ' + value);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2024 06:18 AM
Hi arjun0101 ,
You can use the .split() method to separate the string and convert it into an array, making it easier to apply a loop with the array.Try with following code. try with this code.
// Example string variable
var v = 'str,pqr,atf';
// Split the string into an array using the comma as a delimiter
var valuesArray = v.split(',');
// Iterate over the array using a for loop
for (var i = 0; i < valuesArray.length; i++) {
// Access each value using the index
var value = valuesArray[i];
// Do something with the value (e.g., log it)
gs.info('Value: ' + value);
}