I need to allow multiple answers for a checkmark group, but no more than 3 out of 9 can be checked. Is there a way to configure this without a script rule?
If a script rule is needed , is there a way to know at the field group how many fields were checked?.
Thanks in advance for any help you can provide.
If a script rule is needed , is there a way to know at the field group how many fields were checked?.
Thanks in advance for any help you can provide.
Comments
5 comments
Your issue can be resolved only with using a script rule.
In this script you should to add every checkmark independently (not a checkmark group). Then in the script rule you can address to each checkmark as individual field so the script can see how many checkmarks are checked and warn if there are more than 3 out of 9 answers are checked.
You should create a set of rules - one for each checkmark group. Add all checkmarks in this group and then iterate them using a loop and calculate how many are checked.
For example:
int checkedCounter = 0;
for (int i =0; i < context.fields.count;="" i++){="">
if ((bool)Context.Fields.Value == true) {
checkedCounter++;
}
}
if (checkedCounter >= 3){
Context.CheckSucceeded = false;
Context.ErrorMessage = "No more than 3 checkmarks should be checked";
}
Maybe this could be implemented at the Checkmark Group level , data properties. Instead of "Allow empty selection" & "Allow multiple selection", "minimun selection items" and "max selection items" could be indicated, making this validation easier to implement. Thanks again for your support.
Can be a way to count the quantity of fields in a group, I have a group and inside there are 175 checkmarks group with 5 chekmarks by each one.
I would like to do the following:
- Connect to a DB (Done)
- Compare the name of the checkmark group and a list of a table from the DB
- Once matched, compare the checkmark selected and compare with the second value of the table, if its ok we set the third value of the table into a clear field.
It is for an university test, you can se the image for reference
Please sign in to leave a comment.