Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
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

 

  • Verified answer
    EricRegnier Profile Picture
    8,714 Most Valuable Professional on at
    Re: Building parent child schema in Dataverse for Team

    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!

  • Ram Prakash Profile Picture
    5,179 Super User 2025 Season 1 on at
    Re: Building parent child schema in Dataverse for Team

    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.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 19

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 15 Super User 2025 Season 1

Overall leaderboard

Featured topics