Convert list variable values to string and be copied into a single line text variable

alberttagle
Tera Contributor

Hi,

I need help on how to create a catalog client script to convert a list variable containing values from a table to a string and will be used as part of a single line text variable.

 

Details:

I have a list variable calling from core_country.list which displays the values from 'name' column.

users could select multiple values.

 

The requirement is to copy the selected values (countries) to a single line text field, separated by commas.

 

1 ACCEPTED SOLUTION

Sujatha V M
Kilo Patron
Kilo Patron

@alberttagle  Please follow the below steps to populate the values to the string field. 

 

1. OnChange client script for list collector 

 

SujathaVM_0-1712335853433.png

 

2.  Create and call the script include in client script, 

 

SujathaVM_1-1712335909322.png

3.  Finally the result of cascading the values to string field.  

 

SujathaVM_2-1712335961597.png

 

Note: Kindly ignore the "Alerts" which I have used for testing it. 

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

View solution in original post

8 REPLIES 8

Sujatha V M
Kilo Patron
Kilo Patron

@alberttagle  Please follow the below steps to populate the values to the string field. 

 

1. OnChange client script for list collector 

 

SujathaVM_0-1712335853433.png

 

2.  Create and call the script include in client script, 

 

SujathaVM_1-1712335909322.png

3.  Finally the result of cascading the values to string field.  

 

SujathaVM_2-1712335961597.png

 

Note: Kindly ignore the "Alerts" which I have used for testing it. 

 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

 

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

Hi, Sujatha.

 

Thanks for this, I need to add some conditions and other variables in conjunction with the above. I tried to do the below but it's giving me an error.

 

Can you pls advise how do I add this to the script include?

2024-04-06_1-46-48.png

@alberttagle 

Remove the lines 14 and 15 inside the function response and move it above line 4. 

Please mark this as helpful and accept it as a solution if this resolves your query.

Thanks,

Sujatha V.M.

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.

I can't get it to work, I removed my condition and I tried using just your scripts as they were to see if they work and only changed the variable names. 

1.png3.1.png3.png