1
0
-1

I am having a scenario to find the count of options that is being selected in the data driven check box. How will we find that?.
Kindly help to assist on this.


Thanks.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi,

      You can add up the number of options that have been populated into the data object.  Options are populated into the data object when they are checked.  A small complication is that if you check an individual checkbox, and then uncheck it, the data object will still contain the label of the checkbox item, but it will be set to false.  For checkbox items that have never been checked, they will not appear in the data object.

      So, in a calculation rule for the field you want to contain your count value, your code to count the selected items would need to look something like this:

      var count = 0;
      for (var i=0, len=data.$myDataField.length; i<len; i++) {
          var label = data.$myDataField[i].label;
          if (data.datadrivenCheckboxGroup[label]) {
              count++;
          }
      }
      return count;


        CommentAdd your comment...