web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Building parent child ...
Power Apps
Answered

Building parent child schema in Dataverse for Team

(0) ShareShare
ReportReport
Posted on by 7

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" 

smko_0-1629629236139.png

smko_2-1629629416662.png

 

This is the child table "TestDetail"

smko_1-1629629327563.png

smko_3-1629629457628.png

 

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

 

I have the same question (0)
  • Ram Prakash Duraisamy Profile Picture
    5,846 Super User 2026 Season 1 on at

    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.

  • Verified answer
    EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    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!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard