cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sel_wee01
Frequent Visitor

CountRows of Parents' Children

Hi all,

 

I have two databases, one is for parent and one is for the child.  In parents database, I have a column named 'Code' while in child database, there's a column named 'childCode' which is the foreign key(related to 'Code' from parents database). Let say I have 5 records of code 'A1' and 3 records of 'B1' in child's database. How can I show this total number(or rather countrow) of each parents' child record in my gallery? I tried to use CountRows but seems just can't get it right. Hoping to get some inputs from you. Thanks guys.

4 REPLIES 4
dpoggemann
Solution Sage
Solution Sage

Hi @sel_wee01 ,

 

It looks like this post is same as what you are looking for.  Hopefully this helps!  https://powerusers.microsoft.com/t5/Building-Power-Apps/How-show-number-of-children-in-parent-galler...

 

Thanks,


Drew

gabibalaban
Super User II
Super User II

Hi @sel_wee01 ,

If correctly understand your issue, your gallery items property should look like:

GroupBy(childTable, “childCode”,”Result”)

and inside the gallery put a label with the text property set to:

CountRows(ThisItem.Result)

 

Hope it helps !

 

sel_wee01
Frequent Visitor

Thanks for the feedbacks! I forgot to mention that I want to show that inside the parents' gallery. So I created a label and want that label shows the total number of child having that particular code. If I set the property to CountRows(childTable.childCode), the label will show the total number of all child(regardless the code), which is not what I want. I tried 'ThisItem.Code=childTable.childCode' but no success.

 

Thanks @dpoggemann . I saw that solution but is it possible if I dont want to have another gallery inside another gallery? Instead just one parents gallery with a label that shows the number of rows related to the child?

Thank you again!

@sel_wee01 ,

 

In this case, instead of using CountRows(childTable.childCode), use in label (inside parent gallery)- Text property:

CountRows(Filter(childTable,childCode=Thisitem.Code))

but this can cause loading delay on a large set of date as you'll distinctly interogate childTable for each parent Code.

 

Hope it helps !

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (46,360)