Create multiple rows v2.26.0
Creating rows with the Data+ Table
usually requires a reload of the app. This can be a bit tedious if several rows are added in quick succession.
There are a few tricks to simplify this process for the user. In this example, we will use Data+ Flow.
Server
- Create an API Key, that allows updates for the desired table
Table
- We will not use the
Create DB entry
option of the table - Add a custom button to start the process (Settings->General->Table Styling->Info bar->Custom buttons)
- The
Dialog
optionInput
will allow the user to enter the desired rows - Create a rule with trigger
Custom button
and aSend Data+ message
action, this allows us to communicate with theFlow
extension - The actions parameters can be used to send the user input
- Leave the Function value empty for now and close the rule editor
Flow
- Add a
Data+ Flow
extension to the sheet - Change the trigger section by disabling
On Init
and instead enableUse Data+ Message
- Open up the
Flow
editor (you can use the edit button inside the extension object while in edit mode) - Add an
Iterate
block inFor
mode ranging from 1 to [stepData
][Parameter 1(Trigger)
]- The trigger parameters are the values that will be send with the
Data+ message
- The trigger parameters are the values that will be send with the
- Add the
DB Write
block to the Loop part- Select your table and insert your API-Key
- Other column values could be prefilled here as well
- Finally add a
Reload
block to refresh the app and load the new rows from the Data+ database
Table
- Back in the
rule editor
of the Table the function input should suggest the correctData+ message
function name
That is the basic setup, that allows creating multiple rows at once. Some further thoughts:
- It is probably a good idea to validate the user input before execution (the rule conditions can be used for that)
- Add some loading feedback for the user (e.g.
Loading overlay
rule action) - Change the background of the
Flow
extension so it not visible in view mode - We are using the auto generated id by the database, mapping the rows to another table is best done in a separate column
Last updated on