Update field in table when record is added to child table

I need to update a Due Date field on a table Leak when a record is added to the child table Repair. I tried to use the Related Repair Count field (count([Related Repairs]) > 0, but it seems like the Leak table is not updated when the new Repair record is added. I can’t see how to run a workflow based on additions to the Repair table to trigger the update to the Leak table.

I am new and just learning Appsheet, so I tried to simplify things by recreating the example in this article: https://help.appsheet.com/en/articles/1363923-changing-data-from-a-workflow-rule-or-scheduled-report, but it seems like step 3 does not work. I created the actions in steps 1 and 2. But when I create the workflow using Target data = Projects, only the Actions associated with Projects are available. The actions created in steps 1 and 2 are associated with Employees. Can somebody please help me see what I am missing here? Thanks!

Using virtual column to trigger action is not recommended from my prospective. I understand you have virtual column to count the number of child table being associated to parent row.

I do suggest to consider the different approach, i.e. using action.

Create action to update the value in parent table - due date. Action category is set the values of some column in this row.

Then

On the child table, create new action Execute an action on the set of the rows. Referenc table, select the parent.
Reference row, put select expression like this

SELECT(ParentTableName[ParentTableKeyColumn],[_THISROW].[FIeldSetRefToParent]=[ParentTableKeyColumn])

Reference action ; action you created in the parent table.

Then one more step. Create workflow. Select Child table to append this workflow. And select ADDS ONLY

DO THIS PANE, select DATA and pick up action name in child table.

Try.

2 Likes

Thanks @tsuji_koichi, that worked

2 Likes

Good to know you solved the problem.

I have similar case. The child table has due date column. I need to update the master table with due date from child table.

How do I update this in Action 1?

Create action to update the value in parent table - due date. Action category is set the values of some column in this row.

Set these columns : due date = ???

Action 1

  • For a record of this table: (parent table)
  • Do this: Data: set the values of some columns in this row
  • Set theses columns:
    • (due date column): MIN([Related childs][due-date]) (replacing Related childs with the name of the system-provided REF_ROWS() virtual column in the parent table that references the child table, and due-date with the name of the due date column in the child table)

Action 2

  • For a record of this table: (child table)
  • Do this: Data: execute an action on a set of rows
  • Referenced Table: (parent table)
  • Referenced rows: LIST([parent-ref]) (replacing parent-ref with the name of the column of Ref type in the child table that refers to the parent table)
  • Referenced Action: (action 1)

To make use of the above, either:

  1. Set action 2 as the Form Saved event action for the form view of the child table. Note that this approach will only update the parent due date when an app user adds or edits a child row in a form.

    OR

  2. Create a workflow for the child table that performs action 2 in response to any change. This approach will catch any child due date change, but the recalculated parent due date will only be calculated when the app syncs.

2 Likes

MIN([Related childs][due-date])

What would be the equivalent to this when trying to return a non-numeric value from the most recent child record?

ANSWER:

LOOKUP(
MAX(
SELECT(
My Table[_ROWNUMBER],
([_THISROW].[Thing] = [Thing])
)
),
“My Table”,
“_ROWNUMBER”,
“Wanted Column”
)

Thanks for posting this already Steve

1 Like