Counting Boolean

0
I have 6 different boolean in my entity.  I created checkboxes for every one of them on a page. Then, I tried to make a validation microflow. I want to continue validation when 2 of these 6 checkboxes total are true. If all are false, or 1 or more of 2 are true, an error message should be returned. I tried using "count" to compare the number of true but it didn't work. How can I solve this? Thanks in advance.
asked
2 answers
0

Hi Ayberk,

 

there are different options for solving this.

 

You could for example build something like this as a validation microflow:

 

Hope this helps!

 

Cheers,

Jan

answered
0

Count only works as object list operation, while you want to count attributes.

 

As far as I know, it isn't possible to count the true values of attributes in the same entity.

Solutions

  1. your booleans are answers on a question right? If this is not static, but a dynamic list of questions, I would convert a questions per attribute to an object per question. thus a question list. In that case its easy to filter the true answered questions and count that list.

    If my assumption is wrong then;
  2. Create a validation microflow: https://academy.mendix.com/link/modules/95/lectures/785/8.3.1-Create-a-Validation-Microflow
    And replace the boolean variable with an integer variable, and add one up each time when a boolean attribute is set to true. At the end of the microflow you can return true when integer is >=2 otherwise return false

Hope this helps.

answered