If this has been answered and fit exactly to my environment, please point me to the link. I been searching for weeks but unable to find a solution that based on dataverse for team. The scenario is building an expense report which will have approval flow etc. I know there are several videos for this including Reza Dorrani but those are not dataverse for team.
This is the parent table "TestHeader"
This is the child table "TestDetail"
All data shown are input manually for illustration purpose.
My question is how do I link whatever line items the user input into TestDetail through Power Apps to the one parent ID (HeaderKey), and the TotalCost column of TestHeader will aggregate the LineCost automatically.
All these must be done in Dataverse for Team, hence some functions wont work e.g. calculated/rollup field
Hi @smko,
You'll have to calculate with you canvas app. @rampprakash solution won't work in DV4T. Here's an exmaple:
CountRows(Gallery1.Selected.Cars)
Where Gallery1 is control mapped to the parent table (TestHeader in your case) and Cars is the child where the lookup column is (TestDetail in your case).
Hope this helps!
Hi @smko ,
Based on your scinario, i feel Rollup(Out of the box) in "Test Header" for TotalCost will work Properly.
if you think its not working
QueryExpression getTotalTestDetail = new QueryExpression("new_testdetail");//new_testdetail is logicalname
getTotalTestDetail.Columnset = new Columnset("cra18_linecost");
getTotalTestDetail.Criteria.AddCondition(new ConditionalExpression("new_ColHeader",ConditionalOperator.Equals,GuidofGetHeader);// new_colderhearder is the header name for header;
EntityCollection getValuesChild = service.RetireveMultiple(getTotalTestDetail);
int collectLineCost =0;
foreach(var loopgetValues in getValuesChild.Entites){
if(loopgetValues.Attributes.Contains("cra18_linecost"){
collectLineCost = collectLineCost + ((Money)loopgetValues.Attributes["cra18_linecost"]).Value;
}
}
Entity updateHeader = new Entity("cra18_lineheader");
updateHeader.Id = GuidofGetHeader;// new_colderhearder is the header name for header;
updateHeader["cra18_totalcost"] = collectLineCost;
service.Update(updateHeader);
Use plugin like above code to implement logic in Dataverse to achieve the same.
mmbr1606
22
Super User 2025 Season 1
stampcoin
19
Michael E. Gernaey
15
Super User 2025 Season 1