Variables in a variable set

miyu
Tera Guru

I want to get the value of a variable in a variable set in a catalog client script.
How do I set up the catalog client script?

1 ACCEPTED SOLUTION

Rajneesh Pande1
Kilo Expert

Hi Miyu,

Is your variable set a normal variable set or multirow variable set?


For a normal variable set you can retrieve the value as follow:
var a = g_form.getValue('yourvariablename');

For multiRow variable set following is the syntax:
var serv = g_form.getValue('variableSetName');
var servData = JSON.parse(serv);

After parsing the JSON you can reterive the values:

var a = servData[i].yourvariablename;

here i is the index from which you want to reterive data.

Also you can define an array and store data in that array if there is multiple values.
var appSerSysIDList = [];

for (i = 0; i < servData.length; i++)
appSerSysIDList = appSerSysIDList + servData[i].yourvariablename+ '\n';
g_form.setValue('varName_where_you_want _to_store', appSerSysIDList.trim());

Please reach out if you need more clarification regarding multirow variable set.


Hope this helps.
Please mark the answer correct/helpful as applicable.

View solution in original post

8 REPLIES 8

Hi.

And if the variable is in a variable set?

Thanks

Rajneesh Pande1
Kilo Expert

Hi Miyu,

Is your variable set a normal variable set or multirow variable set?


For a normal variable set you can retrieve the value as follow:
var a = g_form.getValue('yourvariablename');

For multiRow variable set following is the syntax:
var serv = g_form.getValue('variableSetName');
var servData = JSON.parse(serv);

After parsing the JSON you can reterive the values:

var a = servData[i].yourvariablename;

here i is the index from which you want to reterive data.

Also you can define an array and store data in that array if there is multiple values.
var appSerSysIDList = [];

for (i = 0; i < servData.length; i++)
appSerSysIDList = appSerSysIDList + servData[i].yourvariablename+ '\n';
g_form.setValue('varName_where_you_want _to_store', appSerSysIDList.trim());

Please reach out if you need more clarification regarding multirow variable set.


Hope this helps.
Please mark the answer correct/helpful as applicable.

Hi @Rajneesh Pandey ,

Can you please help me achieving this through workflow.

karunakarsu
Tera Contributor

g_form.getValue('variableName');