MRVS issues

SandeepKSingh
Kilo Sage

How to add rows dynamically in Multi Row Variable set (MRVS) based on input value of Catalog item ??

3 ACCEPTED SOLUTIONS

Ravi Gaurav
Giga Sage

Hi @SandeepKSingh 

You can achieve this with an onChange Catalog Client Script on the numeric field (e.g., No. of Companies Worked).
When the value changes, dynamically build and set the MRVS JSON using g_form.setValue().

Example:

 
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || !newValue || isNaN(newValue)) return; var rows = []; for (var i = 0; i < newValue; i++) { rows.push({ company: "", position: "", start_date: "", end_date: "" }); } g_form.setValue("employment_details", JSON.stringify(rows)); }
  • employment_details is the internal name of your MRVS.

  • This creates the specified number of blank rows automatically when the user enters a number.

 
 

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@SandeepKSingh 

what did you start with and where are you stuck?

these links should help you

How to add rows in multi row variable set based on variable choice order 

How to add rows dynamically in Multi Row Variable set (MRVS) based on input value of Catalog item

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

Ravi Gaurav
Giga Sage

Hi @SandeepKSingh 

You can achieve this with an onChange Catalog Client Script on the numeric field (e.g., No. of Companies Worked).
When the value changes, dynamically build and set the MRVS JSON using g_form.setValue().

Example:

 
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || !newValue || isNaN(newValue)) return; var rows = []; for (var i = 0; i < newValue; i++) { rows.push({ company: "", position: "", start_date: "", end_date: "" }); } g_form.setValue("employment_details", JSON.stringify(rows)); }
  • employment_details is the internal name of your MRVS.

  • This creates the specified number of blank rows automatically when the user enters a number.