Community

How to limit checkmark group answers in FC11 R3

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.
0

Comments

5 comments

  • Avatar
    Anastasiya Nechaeva
    Hello atorino,

    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.
    0
  • Avatar
    Alberto Torino
    It's a pity. That is going to be a very time consuming task and very boring indeed. There are too many checkmarks in the document definition (6 A3 pages). Thanks, anyway for the advice.
    0
  • Avatar
    Anastasiya Nechaeva

    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";

    }

    0
  • Avatar
    Alberto Torino
    Thanks for your support Anastasiya- I have more than 50 checkmark groups in my document definition that require this validation. I will spend some time copying and pasting code and adding fields to the available fields for the rule ... I wanted to be sure there was no other (easiest) way.
    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.
    0
  • Avatar
    franco.padilla
    Hi everybody,
    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


    0

Please sign in to leave a comment.