UPDATE CHILDREN TABLE BEFORE PARENT TABLE

Good morning all,

Despite a lot of reading and trying, I can't automatically update the child table when I modify the parent table.
In my example, I created a parent row, then I created multiple children rows.

So far,  everything is working fine.
I sometimes need to correct or change, for example the location or the phone number in the parent file and I want this to automatically update in the children file (without having to open each children line)
I tried to go through
ACTION and Data: Set execute an action on a set of rows, Referenced Action: Edit but it doesn't work😓.

Can anyone help me🙏?

Renaud1_0-1648847542977.png

 

 

Solved Solved
0 8 472
2 ACCEPTED SOLUTIONS

Saut Renaud,

Pardon j'ai oublié une étape intermédiaire. Les voilà de nouveau:

  1. Ajouter une colonne normale "Refresh" dans la table Children, Number, Initial value: 1. 

  2. Creer une action: refreshChild, avec les réglages suivants:
    • For a record of table: Children 
    • Data: Set values of some columns in this row 
    • Colonne: Refresh, Expression: [Refresh] + 1 

  3. Creer une autre action: refreshChildren, avec les réglages suivants:
    • For a record of table: Parent 
    • Data: Execute an action on a set of rows 
    • Referenced Table: Children 
    • Referenced Rows: [Related Children] 
    • Referenced Action: refreshChild 

  4. Dans la Form View de la table Parent, definir refreshChildren comme la Form Saved action.

View solution in original post

Create New Action and name it Update_Child

For a record of this table: Children

Data:  Set values of some columns in this row 

Set these columns: 

NAME = [ID PARENT].[NAME]

SURNAME = [ID PARENT].[SURNAME]

LOCATION = [ID PARENT].[LOCATION ]

PHONE NUMBER = [ID PARENT].[PHONE NUMBER]

 

Create New Action and name it Select_Children

For a record of this table: Parent

Data: execute an action on a set of rows

Referenced Table: Children

Referenced Rows: [Related Children]

Referenced Action: Update_Child

 

In your Parent_Form view, set Event Actions: Form Saved = Select_Children

 

But i agree with @TeeSee1 , It is not a good practice to have redundant data.

You don't need NAME, SURNAME, LOCATION , PHONE NUMBER in your Children records since you have them already in your Parent Table.

View solution in original post

8 REPLIES 8

  1. Add a new normal column in your children table, call it "Refresh". This column will be of type Number, Initial value: 1. 

  2. Create an action refreshChildren, with the following settings:
    • For a record of table: Children 
    • Data: Set values of some columns in this row 
    • Refresh column, with the expression: [Refresh] + 1 

  3. Make refreshChildren the Form Saved action in your Parent form view. 


Bonjour Joseph,

Merci pour votre réponse, deux problèmes que je rencontre
1 : Lorsque j'ai créé ACTION REFRESH, je n'arrive pas à récupérer la colonne REFRESH qui est dans CHILD lorsque j'utilise la table PARENT.

Renaud1_0-1648981925182.png

 

2 : Je n'arrive pas à récupérer une action que j'ai créée dans la vue Formulaire parent

Quelles sont mes erreurs ?

Ci-joint un exemple d'application avec les tests

 

Lien du navigateur

https://www.appsheet.com/start/064284bb-ab85-442b-948c-27c2bb5b59fb

Cordialement

 

Renaud

 

Show us exactly what you did.

More importantly, why do you even need these for fields in the child's records? You have a col that ref the parent row and whenever you need information from the associated parent record, all you have to do is de-reference it.

It is not a good practice to repeatedly/redundantly store data.

Saut Renaud,

Pardon j'ai oublié une étape intermédiaire. Les voilà de nouveau:

  1. Ajouter une colonne normale "Refresh" dans la table Children, Number, Initial value: 1. 

  2. Creer une action: refreshChild, avec les réglages suivants:
    • For a record of table: Children 
    • Data: Set values of some columns in this row 
    • Colonne: Refresh, Expression: [Refresh] + 1 

  3. Creer une autre action: refreshChildren, avec les réglages suivants:
    • For a record of table: Parent 
    • Data: Execute an action on a set of rows 
    • Referenced Table: Children 
    • Referenced Rows: [Related Children] 
    • Referenced Action: refreshChild 

  4. Dans la Form View de la table Parent, definir refreshChildren comme la Form Saved action.

Hello Joseph

It also works very well, thank you for your time..👌

Renaud

Create New Action and name it Update_Child

For a record of this table: Children

Data:  Set values of some columns in this row 

Set these columns: 

NAME = [ID PARENT].[NAME]

SURNAME = [ID PARENT].[SURNAME]

LOCATION = [ID PARENT].[LOCATION ]

PHONE NUMBER = [ID PARENT].[PHONE NUMBER]

 

Create New Action and name it Select_Children

For a record of this table: Parent

Data: execute an action on a set of rows

Referenced Table: Children

Referenced Rows: [Related Children]

Referenced Action: Update_Child

 

In your Parent_Form view, set Event Actions: Form Saved = Select_Children

 

But i agree with @TeeSee1 , It is not a good practice to have redundant data.

You don't need NAME, SURNAME, LOCATION , PHONE NUMBER in your Children records since you have them already in your Parent Table.

Hello Jervz,

Thank you for your solution, it works perfectly!!!🙏

I am concsient, and I thank TeeSee for reminding me that there should be no redundancy between tables.

The application is in development, it is for the generation of document in word mailing that I need it for the moment. When I generate directly from the application, I can delete these duplicates.

Thank you all

Top Labels in this Space