Hi everyone,
Is it possible to add more than one row to another table based on referenced fields using actions?
So the rows added will make use of values from the parent table and referenced fields from the child table. I know you can change values in the referenced fields in more than one row but can you add rows?
Thank you,
Hyman
Hey Hyman,
I think I understand your question, however, are you able to draw a table / diagram to show exactly what you are trying to do?
If it is what I think it is, I actually have something I have already built that does so.
1 Like
Hi Ryan, thanks for looking into this.
I think I can explain it like this.
There are 4 tables - Two parent with each a child:
Families with child table Members - so the members of the family
Training with child table Trainees - so the trainees partaking in the training.
Sometimes the whole family need to partake in the training. So you can add the Family to the Training and then I want to run an action that would add all the Members of the family as Trainees to the Training.
Hope this is clear enough. Thank you
Hi @Hyman_van_Zyl ,
Great question!
You could try this type of action: Data: add a new row to another table by using values from this row.
From AppSheet Documentation ↓
By creating a new Action and specifying which separate table data should be added to and defining each column added, rows of data can quickly be updated and moved across all tables in your application.
The Action setup shown below produces the effect of copying the Email and Course values from the student table, and using the TODAY() and TIMENOW() expressions, to log the Email, Course, current date and time as a new row in the attendance table:
Link to Source: https://help.appsheet.com/en/articles/953637-actions-the-essentials
Let me know if this helps or if you have any other questions.
Thanks,
Austin from AppSheet Training
2 Likes
Thank you Steve, this looks as if it could help. Will have to wrap my head around it. In the second example - add a set of rows - have to see if I can add values from both Master and Source table to the Target table.
Will get back,
Thanks
Hyman
1 Like
How did you go with this @Hyman_van_Zyl ?
Hi Steve, at last, I had a chance to work on this problem. This is so beautiful, it brings a smile to see those rows populate automatically. It is extremely useful for many aspects of my app.
Just one thing I am struggling with a little. So I am using your second example above to copy referenced rows from a source table to a target table when you add an entry into a master table. There is one field that needs to copy that can only be determined by the master table. So I used your maxrow(“Master Table”, “_rownumber”) in the source table to generate this field. When I add a row in the master table and save, all field populate perfectly except this one. It does not use the value of the current entry that I saved but of the one just before. As if it first saves the new rows in the target table and then the master table entry. Any advice?
1 Like
I got it working, I added your maxrow(“Master Table”, “_rownumber”) virtual column to the target table and used the initial value to add it to the relevant row. Working perfect. Yeahi, thank you. This post is now solved
1 Like
Hi Ryan,
The procedures suggested by Steve works wonderfully. I think I used the 2nd
one he suggested. Thanks for the assistance.
Hyman
–
Hyman van Zyl
0738979179
www.aidit.net
https://www.facebook.com/hymanvanzyl
https://www.linkedin.com/in/hymanvanzyl/
–
Optimizing Aid with IT
1 Like