Calculations Using Fields With Options

Within the Rulestar system, fields with options (select, radio and checkbox fields) can be used in calculations when their option values are numeric (except for the "Count" method explained below). A common usage of calculations using fields with options is counting the number of "Yes" responses over a number of Yes/No question. Here, each "Yes" and "No" label is given the value of 1 and 0 respectively.

 

In the examples that follow, FIELD represents a field with options.

 

"Options" Properties

In addition to the basic operators (addition, subtraction etc) that are used in calculations using number fields, fields with options have four option properties that can be accessed through Rulestar's calculation interface. They are:

  • Options.Sum,
  • Options.Min,
  • Options.Max, and
  • Options.Count.

The first three properties, "Options.Sum", "Options.Min" and "Options.Max" only exist when all option values are numeric:

  • FIELD.Options.Sum returns the sum of the values of all options,
  • FIELD.Options.Min returns the minimum value of all options, and
  • FIELD.Options.Max returns the maximum value of all options.

FIELD.Options.Count returns the total number of options (option values are not considered in its evaluation).

Accessing each property is easy - simply select the desired field in the calculation builder and complete the calculation by typing desired property eg, ".Options.Count". For example:

FIELD.Options.Count

Remember, when accessing an "Options" property, the calculation will consider all field options (not those selected).

 

Checkbox properties

Checkbox fields are unique in that they can have more than one option selected. This means that checkbox fields have additional properties, being the properties of the options selected.

In addition to the four properties listed above, you can use the following four properties:

  • Sum,
  • Min,
  • Max, and
  • Count.

As with the "Options" properties, the first three properties, "Sum", "Min" and "Max" only exist when all option values are numeric:

  • FIELD.Sum returns the sum of the values of the selected options,
  • FIELD.Min returns the minimum value of the selected options, and
  • FIELD.Max returns the maximum value of the selected options.

FIELD.Count returns the total number of options selected (option values are not considered in its evaluation).

Min and Max are only valid for required fields.

Please see this demonstration of this calculation.