I want to auto populate the number in multirow variable set for each row

Akshaya14
Tera Contributor

Hi Team ,

 

I have a requirement to auto populate  the number field in multirow variable set in ascending order . 

In the multirow variable set we have a field called "Number of Chefs" each time when we add one row that time the number of chef should auto populate starting from 1 . 

Note: Field type is string Thanks in Advance 

Akshaya14_0-1665749049664.pngAkshaya14_1-1665749057997.jpeg

 

  

 

 

    

 

5 REPLIES 5

Muhammad Khan
Mega Sage
Mega Sage

If MRVS is being used in Record Producer, then try utilizing below record producer script.

 

var mrvs = JSON.parse(producer.<mrvs_backend_name>);

for(var i=0; i<mrvs.length; i++){
        mrvs[i].<backend_name_of_number_column> = i+1;
)

 

 

If MRVS is being used in Catalog Item (Not Record Producer), then try with below onSubmit() Catalog Client Script.

 

function onSubmit(){

        var mrvsValueStr = g_form.getValue('<backend_name_of_mrvs_variable>');
        var mrvs = JSON.parse(mrvsValueStr);

        for(var i=0; i<mrvs.length; i++){
                mrvs[i].<backend_name_of_role_owner_variable> = i+1;
        }
}

 

The above record producer script is not working , that is not getting into the MRVS 

What did you try?

Can you share your script?

sree10_0-1666239223745.png

please find the above script which i have tried in record producer script