Actions not triggered in Child form save

(Apologies if this has been asked before. I couldn't find a post that answered my question. Please point me to it if it exists)

For this order app, I want the parent Order table to have a Total price, created from the child OrderDetail table's subtotal.
I've tried:

1. Setting initial value in tables to a SUM(SELECT(OrderDetail[OrderDetail_subtotal],[Order_ID]=[_THISROW].[Order_ID])) I suspect that it didn't work since it's not in the same form.

2. Creating triggering action where OrderDetail save will calculate Order total. It didn't work. No total for related Order was created; value was 0. But it works if I edit the OrderDetail row, and save (after the Order row has been created and saved). It will update the related Order to the correct total. So I suspect that the triggering action doesn't work when you're saving forms while creating the parent row (ie. creating a new OrderDetail within the Order form).

I'm wondering if I'm missing something very obvious. Or maybe I've been working too long and need a break 😂

Edit: Added line breaks and context. They disappeared when I posted. 

0 1 85
1 REPLY 1

First, context matters.  If you are adding/editing OrderDetails using an Add/Edit action from the Order Form,  that child OrderDetail Form is within the context of the Parent.  In this case, any actions attached to the FormSaved behavior of the OrderDetail Form will be ignored.  Not sure why.

If you open an existing OrderDetail row NOT from the Parent Form, but from the Parent Detail view OR directly from an OrderDetails view of some sort (not already within the Parent context), then any FormSaved behaviors should be executed.  In this case, to update the Parent row Total Price, your action needs to trigger an update on the parent row in some way.


@Just_a_noobie wrote:

2. Creating triggering action where OrderDetail save will calculate Order total. It didn't work. No total for related Order was created; value was 0


Based on my understanding, it seems like this should have worked.  Can you provide more details on what you implemented?

 

 

Top Labels in this Space