- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 08:05 AM
Kindly advice script for count the comma separated values and update in another variable.
i have single line text contain values like 2009 , 2010, 2011 ...etc when they are entered these count has to update in another variable
ex: single line text variable1 : 2009 , 2010 , 2011
(single line text) variable4 has to update as 3
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 08:18 AM
Hi,
Please try this script.
var value = "2009 , 2010 , 2011";
var count = value.split(",").length;
alert(count);
g_form.setValue("variable4", count);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 08:18 AM
Hi,
Please try this script.
var value = "2009 , 2010 , 2011";
var count = value.split(",").length;
alert(count);
g_form.setValue("variable4", count);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2020 08:28 AM
Hello Swati
do you need this on client side or server side?
In server side, here is how you can do it in BR.
var val = current.variables.var1.toString();
val = val.split(",");
current.variables.var4=val.length;
For client side, you can use the code provided by Ali.