Count Boolean True Values and add to Integer

Hey guys, so I have an app where the user can answer a survey type form and at the end I want to count each answer that was answered with yes/true. The result should be saved into another attribute of the same entity with the type Integer. So for example if the user answers 5 out 10 questions with true, it should save 5 to the new attribute. Do you know how I can implement this? My first idea was to create a microflow at the end of the survey that changes the object, but I don’t know how I can count the values there. Each question is its own boolean attribute by the way. Thanks in advance
2 answers

Hi Furkan,

In this case I think you should take the following steps:

  1. Create a microflow after the survey
  2. Retrieve all the questions associated with this user/survey. Set the xPath to true on the boolean you mentioned
  3. You now have a list of all true answers
  4. Use the aggregate list activity on this list and set the function to count. This counts all positive answers to an integer.
  5. Use the change object on the entity and set the new integer attribute to $count.


(If you can't do a database retrieve, since the questions haven't been committed, you should retrieve them over association and the use the list operation activity ‘filter’ to filter only the questions where the boolean is true.)

Let me know if this helps!


You can add an On change microflow on all the answer booleans. As soon as an answer is marked as true you can increase the counter and if it marked back as false then you can decrease the counter.

Counter in this case being the variable you are using to store the final count.