I have a survey recording types of litter found during litter picks. We added a repeat field to the end of the survey for users to record items that were not listed in the categories provided on their tally sheets. In this repeat, the users are asked to provide:
- An item description (e.g. sunglasses) - text field
- The material type (e.g. plastic) - select one field
- And the total number of these items found (e.g. 2) - integer field
I can use the aggregate functions to calculate:
- The total number of items counted: sum(${Total_count})
- The number of different item types: count(${Item_description})
But I can't seem to be able to calculate the total number of items counted by material type. I have tried using an if statement:
if(selected(${Material_type}, 'Plastic'), sum(${Total_count}), 0)
But the value always returns 0, even when the statement is true. Is this possible within Survey123?