Summarize or Count Repeats inside Repeat

928
2
Jump to solution
01-27-2022 11:32 PM
bhariadi
New Contributor III

Hi,

I have parent & child repeat. Parent-Repeat are Storages and Child-Repeat are Books.

I am using sum(${}) and coalesce(${},0) to count all books, but when I add new Storage ID, the Total Number of Book reset and started to zero.

Is there a way how to count all books? or how many book already counted?

From the picture below, the Total Numbers of Books should be 3 books.

Thanks.

Capture221.JPG

 Capture222.JPG

 

 

 

 

 

 

 

 

 

 

 

Capture223.JPG

 

0 Kudos
1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @bhariadi 

Thanks for providing your XLSForm.

Please see attached a simplified XLSForm that attempts to solve your problem using the count() function, and also by rearranging the questions slightly.

One thing to note here is that I've avoided using aggregate functions (sum, count, etc.) inside the repeat that the function is aggregating. Please see the Survey123 Tricks of the Trade: Repeats blog post for some great info, as well as the documentation on repeats.

Hope this useful, please let me know if this works for you.

Best, Jim

View solution in original post

2 Replies
Jim-Moore
Esri Regular Contributor

Hi @bhariadi 

Thanks for providing your XLSForm.

Please see attached a simplified XLSForm that attempts to solve your problem using the count() function, and also by rearranging the questions slightly.

One thing to note here is that I've avoided using aggregate functions (sum, count, etc.) inside the repeat that the function is aggregating. Please see the Survey123 Tricks of the Trade: Repeats blog post for some great info, as well as the documentation on repeats.

Hope this useful, please let me know if this works for you.

Best, Jim

bhariadi
New Contributor III

Hi Jim,

That's great! Thank you for your help. Your solution is work. I will try to implement this concept for My real project.

Will update the result as soon as possible.

Capture228.JPG

0 Kudos