How to show Children Records count on Parent Record List?
Application Type
Reactive
Service Studio Version
11.50.14 (Build 50338)

Hi everyone. I am building a business app for which I have a Parent Table and a Child Table. I would like to add a Children count on my Parent Table's List, like this

Name                            Description                                 ChildRecordCount

ParentRecordAName  ParentRecordADescription                10

ParentRecordBName  ParentRecordBDescription                3


I have tried adding the child table to the parent Aggregate, but that would multiply the number of records. If I add a "Count" then I cannot see the ParentRecord's Attributes. 

I have tried creating another Aggregate just for the "Count" and relating it to "ParentRecord.Current", and it also did not work. 

Any ideas or guidelines here?

Thank you in advance!

Alex


Hi,

You can try as following:

Solution 1: Group by selected Parent attributes (as your image: Name, Description), then Count on Child's Id.

Solution 2: Create a block for Count child, input is Parent's Id. In this block add aggregate to calculate Count and show it in expression. Then in parent table put the block in a column and pass Parent's Id.

Cheers,

Khuong

Solution

Hello @Alexandre Menezes Assis 

Please check out the attached oml. Hope that solves it for you.

Edit: Khuong's post beat me to it by a couple of minutes. My proposed solution in the oml is the same as Solution 1 in Khuong's post.

Regards,

AJ

ParentChildDemo.oml

Hi,

You can try as following:

Solution 1: Group by selected Parent attributes (as your image: Name, Description), then Count on Child's Id.

Solution 2: Create a block for Count child, input is Parent's Id. In this block add aggregate to calculate Count and show it in expression. Then in parent table put the block in a column and pass Parent's Id.

Cheers,

Khuong

Solution

Hello @Alexandre Menezes Assis 

Please check out the attached oml. Hope that solves it for you.

Edit: Khuong's post beat me to it by a couple of minutes. My proposed solution in the oml is the same as Solution 1 in Khuong's post.

Regards,

AJ

ParentChildDemo.oml

Khuong and AJ, thank you both!

I was able to do it using a block. And I finally understood what a block is :D 

Thanks again 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.