I have an SKU table (Child). I would like to create a bulk action that allows my users to select multiple SKUs, and create ONE new Quotation that contains these SKUs (create a parent record in Quotation table).
The problem i face is that if X number of SKUs were selected, the Actions and Bot triggers will be triggered X times. I end up with X number of parent rows instead of only one.
Is there a method to create only 1 row record in a parent table through bulk action?
(PS: Currently, this task is initiated at the parent level, and children are added via a EnumList with data validation. It works. But the intuitive process for my team is to select the child first.)
Solved! Go to Solution.
This is doable and it's not that complicated. The process is this:
#1 - Add one additional text column to your child table, lets call it "Timestamp"
#2 - Create an action to your child table that updates this "Timestamp" column with an expression USEREMAIL()&"_"&NOW()
#3 - Create a Bot for your Child table (Updates Only)
#4 - Add a task "Run a data action" which adds a row to your Parent table
#5 - It needs to write the key column and Enumlist values to that Parent
#6 - The "Timestamp" column writes the value to your key column
#7 - The EnumList column is written with CONCATENATE(SELECT(Childs[ID],[Timestamp]=[_THISROW].[Timestamp]))
When you first bulk select child rows, it updates all of them with the same email address + the same DateTime value as they are read as bulk. And when your Bot is creating multiple parent rows, it actual adds only one because the key value is the same. That means the first update adds the Parent and then the rest of are just updates for the same already created Parent.
Not sure exactly what is you process.. in which table your EnumList column is? Is it in a additional table?
I'll clarify.
Quotation Table (Parent)
SKU Table (Child)
Hence the current Process starts from (1) Quotation row creation, (2) select SKU as the child in the SKU column (EnumList).
My goal: Start the process from (1) SKU Table (Child), bulk select all SKUs that will be the child, (2) through an action, create a Quotation (Parent) and fill the parent table's SKU column with a comma-separated list of child row values.
This is doable and it's not that complicated. The process is this:
#1 - Add one additional text column to your child table, lets call it "Timestamp"
#2 - Create an action to your child table that updates this "Timestamp" column with an expression USEREMAIL()&"_"&NOW()
#3 - Create a Bot for your Child table (Updates Only)
#4 - Add a task "Run a data action" which adds a row to your Parent table
#5 - It needs to write the key column and Enumlist values to that Parent
#6 - The "Timestamp" column writes the value to your key column
#7 - The EnumList column is written with CONCATENATE(SELECT(Childs[ID],[Timestamp]=[_THISROW].[Timestamp]))
When you first bulk select child rows, it updates all of them with the same email address + the same DateTime value as they are read as bulk. And when your Bot is creating multiple parent rows, it actual adds only one because the key value is the same. That means the first update adds the Parent and then the rest of are just updates for the same already created Parent.
Nice!
This solution works. Thank you!
1. Multiple rows are created in the parent initially if the app is not manually synced. The multiple rows stay there until all the changes are synced in the background, after which the multiple rows will be reduced to only 1 row.
2. I attempted to push this solution further by adding one more LINKTOROW action to the group of actions, so that my user can edit the other fields in the parent after the new row is added. This does not work as the LINKTOROW (or other LINKTO functions) to not apply to bulk actions.
#1 - If it creates multiple parents, you are doing something wrong. it won't create more than one parent.
#2 - And even if you could do that, you won't know when is the latest child added.
#1 - To clarify, AppSheet app shows multiple parent rows created, but in the spreadsheet database, only 1 row is created. The multiple rows in Appsheet is only visible for as long as the sync isn't complete. I suspect this is because the action itself is triggered multiple times, but the sync process is only creating once and then updating that same row for the other times. Ultimately, the end result is only 1 parent after sync is complete.
#1 - Still doing something wrong. I made a quick test and it only adds one parent and it's visible in the app only once.
Using bulk actions for this is not an easy approach in AppSheet, though it might be more user-friendly. Instead, I'd suggest adding a button to the parent to start the new quotation and either pre-populate the new quotation with the original's children, or limiting the available children to the original's children.
Thank you Steve.
User | Count |
---|---|
24 | |
14 | |
4 | |
3 | |
3 |