How-to: Creating Conditions for Check Form Fields

A check form field can have two states: Checked and unchecked. Accordingly, the number of conditions that can be created for this form field type is limited to two. The first condition tests whether the check form field is checked. The other one whether it is not checked.

Some examples for applying check form field conditions are listed as follows:

Check form field is checked

To test whether or not a check form field is checked, a condition has to be created where the Isor Is not operator represents the desired checked state. On using the Is operator, the condition is fulfilled, if the CheckFormField.Checked property is set to true. CheckFormField conditions using the Is not operator require the value false.

Image

To create this condition programmatically, use the following code snippet:

// Create conditions
Condition cdIsChecked = new Condition(m_cffCheckFormField1, true);
Condition[] rciConditions = new Condition[] { cdIsChecked };
' Create conditions
Dim cdIsChecked As Condition = New Condition(m_cffCheckFormField1, True)
Dim rciConditions As Condition() = New Condition() { cdIsChecked }

Both check form fields are unchecked

Sometimes it is necessary that more than one condition has to be fulfilled to perform an instruction. For these cases the conditions can be combined by the And logical connective. The following examples show that both checkFormField1 and checkFormField2 have to be unchecked to enforce an instruction.

Image

To create these conditions programmatically, use the following code snippet:

// Create conditions
Condition cdIsNotChecked1 = new Condition(m_cffCheckFormField1, false);
Condition cdIsNotChecked2 = new Condition(m_cffCheckFormField2, false);
Condition[] rcdConditions = new Condition[] { cdIsNotChecked1, cdIsNotChecked2 };
' Create conditions
Dim cdIsNotChecked1 As Condition = New Condition(m_cffCheckFormField1, False)
Dim cdIsNotChecked2 As Condition = New Condition(m_cffCheckFormField2, False)
Dim rcdConditions As Condition() = New Condition() { cdIsNotChecked1, cdIsNotChecked2 }

At least one check form field is checked

Combined conditions where at least one condition has to be fulfilled can be created by using the Or logical connective. The example below describes how to create a condition where either checkFormField1 or checkFormField2 has to be checked to perform an instruction.

Image

To create these conditions programmatically, use the following code snippet:

// Create conditions
Condition cdIsChecked1 = new Condition(m_cffCheckFormField1, true);
Condition cdIsChecked2 = new Condition(m_cffCheckFormField2, true) { LogicalConnective = Condition.LogicalConnectives.Or };
Condition[] rcdConditions = new Condition[] { cdIsChecked1, cdIsChecked2 };
' Create conditions
Dim cdIsChecked1 As Condition = New Condition(m_cffCheckFormField1, True)
Dim cdIsChecked2 As Condition = New Condition(m_cffCheckFormField2, True) With {
    .LogicalConnective = Condition.LogicalConnectives.[Or]
}
Dim rcdConditions As Condition() = New Condition() { cdIsChecked1, cdIsChecked2 }

Check form field 1 is checked or both check form field 2 and 3 are checked

Another option to create combined conditions is using both the And and Or logical connective. As previously described, all conditions that are connected by the And logical connective are considered as one comprehensive condition. It is fulfilled if all its linked conditions are fulfilled. The Or logical connective handles such a condition as one condition. That means that either the group of And-linked conditions fulfill the condition or the condition that is Or-connected to that group.

The following example applies the And logical connective to test whether both checkFormField2 and checkFormField3 are checked. They are combined by an Or logical connective with checkFormField1. The condition is fulfilled if either checkFormField1 is checked, or both checkFormField2 and checkFormField3 are checked. If both checkFormField1 and one of the other two check form fields are not checked, the condition is unfulfilled.

Image

To create these conditions programmatically, use the following code snippet:

// Create conditions
Condition cdIsChecked1 = new Condition(m_cffCheckFormField1, true);
Condition cdIsChecked2 = new Condition(m_cffCheckFormField2, true) { LogicalConnective = Condition.LogicalConnectives.Or };
Condition cdIsChecked3 = new Condition(m_cffCheckFormField3, true);
Condition[] rcdConditions = new Condition[] { cdIsChecked1, cdIsChecked2, cdIsChecked3 };
' Create conditions
Dim cdIsChecked1 As Condition = New Condition(m_cffCheckFormField1, True)
Dim cdIsChecked2 As Condition = New Condition(m_cffCheckFormField2, True) With {
    .LogicalConnective = Condition.LogicalConnectives.[Or]
}
Dim cdIsChecked3 As Condition = New Condition(m_cffCheckFormField3, True)
Dim rcdConditions As Condition() = New Condition() { cdIsChecked1, cdIsChecked2, cdIsChecked3 }