
Hi,
I have an application where I create Sale Order (Parent) and then on other Screen I create that Sale Order Lines (Childs).
I have 2 Lists
1) SaleOrderList (Parent List)
2) LineOrderList (Child List)
As I am passing the Parent List (ID) column in a column (ParentListID) of Child List.
In Child Screen I can have multiple lines of that same sale order and so that I enter Quantity for those lines in PowerApps and after pressing on save I Patch those child lines in Child List and also Update that Parent List (Total Quantity) column with a sum of those child quantity this is working fine,
Problem:
but when I delete those lines from PowerApps Screen and again save it deletes those records from the child list but its not updating the Parent List (Total Quantity) column with null or 0 ( as if there are no child records, so the sum should be zero) but the Parent List is showing that (OLD Quantity SUM) which was saved before using patch.
Any help??
@WarrenBelz
Hello,
After deleting child records. Do a patch on the parent record:
Lets say varParentRecord is the parent record you have selected.
Patch(SaleOrderList, varParentRecord , {AmountOfChildRows: CountRows(Filter(LineOrderList ,ParentID = varParentRecord.ParentID))})
If you have a One To Many RelationShop you could even do the following:
Patch(SaleOrderList, varParentRecord , {AmountOfChildRows: CountRows(varParentRecord.LineOrderList) })
Please accept this answer as a solution if this answer solved your question.
Best Regards,
Anthony