need a script to push multiple values with comma seperated

Raviteja K
Tera Expert

I need a script which will push multiple values into a string with coma separated values. When I glide data from a table it should get multiple values and needs to be in the form of string with comma separated values.

Any references or pointers is highly appreciated. Please do the need,

Thanks in advance.

1 ACCEPTED SOLUTION

awessel
Kilo Guru

The easiest way to do this is probably to build an array, push in values to the array and then use the array's "join(',')" function to convert the array into a comma separated list.



var myStuff = [];



while(doingStuff) {


        myStuff.push(stuff);


}



return myStuff.join(',');


View solution in original post

4 REPLIES 4

raghavak
Giga Contributor

Hello Ravi,



You want to store the values from reference field to string field with out commas. Am I right??


I need to get string in this form India,Sweden,Germany etc


try   replacing with values



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }


g_form.setValue('field1', newValue.join(','));


}


awessel
Kilo Guru

The easiest way to do this is probably to build an array, push in values to the array and then use the array's "join(',')" function to convert the array into a comma separated list.



var myStuff = [];



while(doingStuff) {


        myStuff.push(stuff);


}



return myStuff.join(',');