Update multiple rows to table #8432
Replies: 4 comments 10 replies
-
Hey @applicationuser Part of the challenge is that the form fields within a repeater cannot have unique identifiers. Something noted here: #5944 This can be alleviated by repeating the form as well, so that your component tree looks as follows: The tricky bit then is to aggregate the forms data outside the form component scope. The way I can think to do this is to add an Update State action to the On Change event of each form field (this could be a bit tedious if there are many form fields unfortunately). Then you can update a JS dictionary to keep track of each form state, using the repeater row id as the index, e.g. let formState = $("State.FormState");
const index = $("New Repeater.Sales.Auto ID")-1;
if (!formState) {
formState = {};
}
if (!formState[index]) {
formState[index] = {};
}
formState[index]["itemType"] = $("Field Value");
formState[index]["_id"] = $("New Repeater.Sales._id");
return formState; Next we need a button that will trigger an automation. We need to do this because automations support looping over rows, whereas actions client side do not. return $("State.FormState") ? Object.values($("State.FormState")) : []; This JavaScript takes our dictionary and converts it to an array so that the automation can loop over it Automation
Here is the app export so you can take a closer look: |
Beta Was this translation helpful? Give feedback.
-
HI @melohagan , |
Beta Was this translation helpful? Give feedback.
-
A few comments here as I am also trying to use looping to update/insert multiple rows but I am not very satisfied. Here are my comments:
|
Beta Was this translation helpful? Give feedback.
-
Hi @melohagan, I am using version : 2.19.4. Do you find any error ? |
Beta Was this translation helpful? Give feedback.
-
Hello,
Need your help on how to design a form with multiple data rows update to a single table.
Data from budibase table displayed using repeater form. Based on the user selection criteria , repeater form can have at a minimum of 2 rows to 20 rows of data displayed. similar to a inspection/survey form with list of questions to answer & rating
Layout .
-->Form
----->Data Provider
---------> Repeater
------------->Field Group
is there an option to place save button outside of repeater and trigger update of all the rows selected from Data provider ?
prefer not to have Data provider limit to 1 and save each row, that would require user to go through ~200 rows and save each row.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions