Adding totals score of one item from different groups (not repeating) with skip logic

Hello community, I am trying to get the total of specific items in different groups. The groups contain amounts for different people and at the end I will need the total of each item. These ideally are not repeat groups. the groups are already placed and the skip logic added so that a user can simply add another group in case there is need. How can this addition be done. i have tried out various options but they mainly talk about repeat-groups or loop-enabled. this is the link to the sample form

https://eu.kobotoolbox.org/#/forms/aKWLuMjfHsC7P9RhDwd47P

Hi @Maria4 and welcome to the community!

This is exactly what repeat group is for. Is there a reason that you’re trying to avoid using repeat groups?

1 Like

Hello hakan_cetinkaya, Each group also has specific additions and multiplication within them which require fixing the names or making the names different across the groups to avoid adding up wrong cells due to similar names. I tried using repeat groups but would find some calculations already done in the new group added until I opted for the skip logic. Now totals across the groups are the problem

@Maria4, From what I understand from your request I think it seems it can be done with calculation.

The form you share gives error right now, can you validate it through here first?

1 Like

And can you share a dummy question for us to understand the result that you’re looking for?

1 Like

https://eu.kobotoolbox.org/#/forms/aKWLuMjfHsC7P9RhDwd47P

Sorry there was a spelling error. I have tried it out again with this sample and put only 3 groups. The total calculation shows at the bottom only if I have added information in all the 3 groups. If only 2 are added there is no total at the bottom. The form to be used in data collection will have an allowance of 20 groups so not all will be added by all users some will have only 5 and I will need totals of just those 5 groups. some will have 15 and this is all determining number of groups added. that is why I gave an allowance for 20 groups. How can the ${}+${} addition formula count even unfilled groups or what formula can I use instead.

The dummy question would be: The form given captures information about members of a club. Different clubs have different number of groups and have the potential of adding more groups over the years. Each group has different members depending on the time they meet. What is the total number of women for a club that has 2 groups? How about for a club that has only 1 group?

@Maria4 hi, I still cannot see the form you’re sharing.

Can you share a screenshot of the problem you’re seeing?

Does it say NaN?

1 Like

@Maria4, you should be able to share your XLSForm. If you are still having issues please refresh your page.

1 Like

Oh, thank you all, What i did was to simply use the repeat groups instead of the hidden groups or skip logic and the summation started working.

1 Like

I used the repeat groups but i keep getting an error message when i add another group and fill its data. the message is saying - XPath evaluation: type mismatch. This field is repeated. the message continues to say I need to use indexed-repeat() function to specify the value I want. How can i do this. The issue is getting totals from an item in all groups added.

Please note the preview works well and gets validated fully but the error occurs on the phone app. Please help.

Okay so this is what I have changed. i had put the totals in a group named totals so that i could have them appear on one page but I ungrouped them instead and the form is working perfectly in the app. the totals do not appear on one page but i could work with this. Thanks for all your help community.