How to add rows to a multi row variable set dynamically

mballinger
Mega Guru

Hello,

I have a requirement to add rows to a multirow variable set based off of a selected value from another variable. The dropdown will be numbered 1 through 5. If 4 is selected, 4 single line text rows get inserted. The same applied to all the other selections.

Thanks

 

1 ACCEPTED SOLUTION

Let's take it down a level; this this: 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var mvrs = [];

    for (var i = 0; i < newValue; i++) {
        var tempObj = {};
        tempObj.test_report_number = '';
        mvrs.push(tempObj);
    }
    g_form.setValue('multi_row_variable_set_test', JSON.stringify(mvrs));

}

find_real_file.png

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

11 REPLIES 11

Let's take it down a level; this this: 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

    var mvrs = [];

    for (var i = 0; i < newValue; i++) {
        var tempObj = {};
        tempObj.test_report_number = '';
        mvrs.push(tempObj);
    }
    g_form.setValue('multi_row_variable_set_test', JSON.stringify(mvrs));

}

find_real_file.png

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Awesome this worked like a charm! Thanks for all your help!