Repeat record counter in Survey123

2324
2
Jump to solution
07-12-2018 06:31 AM
MitchEast
New Contributor III

I have a survey where field staff go to predetermined sites and collect multiple records. At each site, they collect information about up to 5 trees in each of 4 tree species groups. So, I created a survey where they record the date and stop #, then it has a nested repeat so they can collect multiple related records at a site (Stop# in image below).

I want to display a counter that tallies the # of trees recorded in each group so that a surveyor knows how many they have collected at that stop. There are four groups and each repeat tree record requires the surveyor to specify which group it belongs to. So, I have four hidden fields that (one for each tree group) that are populated with a 1 or 0 based on if the group is selected (Ex: int(if(selected(${treegroup},'whiteoak'),1,0))).

Right now I have a counter that uses the Calculate field in the form and the sum function that refers to the hidden fields described above. However, the sum function treats the hidden field data as text so instead of getting 1+1 = 2 or 1+0 = 1 it returns 1+1=11 or 1+0=10. How can I get this converted to an integer form? I've tried using the int() but that doesn't work.

The form is attached.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Frequent Contributor

Try putting int  (no brackets or spaces) in the very last field called bind::type.  That did it for me.

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Frequent Contributor

Try putting int  (no brackets or spaces) in the very last field called bind::type.  That did it for me.

View solution in original post

0 Kudos
MitchEast
New Contributor III

Yep, that did it. Thanks for pointing it out.

0 Kudos