An object of the Condition class is an element of the ConditionalInstruction class and represents the state of a FormField that has to be fulfilled to execute the instructions of the related ConditionalInstruction object. The number of conditions inside a ConditionalInstruction object is not limited. If the ConditionalInstruction.Conditions property contains more than one element, each subsequent Condition object is connected to the previous one by an AND or OR logical connective. That implies that all these conditions are considered as a whole when the conditional instruction is tested whether or not the requirements to execute its instructions are fulfilled.

To create a condition, the Condition object has to be initialized with a FormField that is located inside the document. That FormField provides the value to be tested.

Furthermore, a comparison value has to be defined by the constructor's comparisonValue parameter. That value is compared with the FormField's value by using a specified comparisonOperator parameter. The way in which such a comparison is implemented depends on how the set value is interpreted:

• The constructor's isChecked parameter value of a condition that references to a CheckFormField represents a check state to be fulfilled. If it is set to true, the Condition.ComparisonOperator property returns Condition.ComparisonOperators.Is. Otherwise Condition.ComparisonOperators.IsNot. In both cases the Condition.ComparisonValue property returns true.

• Conditions that are related to form fields of type TextFormField or SelectionFormField execute a comparison to the form field's Text property value. That text can be tested as follows: If the comparison value is set to null or an emtpy string, the condition checks whether or not any text is set. If it is a string, that is not empty, by default the value is interpreted as a custom text whose string is compared with form field's text. Alternatively, that string can be handled as a regular expression that checks whether or not the form field's text matches to its pattern. That option can be determined by setting the constructor's textComparisonFlag parameter to Condition.TextComparisonFlags.Regex.

• In addition, the text of a SelectionFormField object can be compared with one of its SelectionFormField.Items array entries or checked whether or not the string equals to one of its SelectionFormField.Items array entries. These comparison types can be determined by setting the corresponding Condition.ItemComparisonFlags enumeration value to the constructor's itemComparisonFlag parameter.

• Up to four different comparison types can be applied to compare the Date property of DateFormField objects with a specified value: If the comparison value is an object of type System.DateTime, the year, month and day of month is compared with the current property value. On setting an integer with an value between 1601 and 9999, the year is compared. If that value is an integer between 1 and 31, the day of the month is checked. An enumeration value of type Condition.Month tests the month and using a System.DayOfWeek enumeration value compares the day of the week. Setting null as the comparison value checks whether or not the DateFormField.Date property value is set.

Syntax

public class Condition : System.IComparable
Public Class Condition
  Implements System.IComparable

Introduced: X18.

Constructors

Constructor Description
Condition Initializes a new instance of the Condition class.

Enumerations

Enumeration Description
ComparisonOperators Determines the comparison operator that is used to compare the condition's form field value with the specified comparison value or the interpretation of that value.
ComparisonValueTypes Determines how the condition's comparison value is interpreted by the condition.
ItemComparisonFlags Determines how the specified comparison value has to be interpreted when comparing it with the SelectionFormField's Text property.
LogicalConnectives Determines how the condition is related to the previous condition inside the corresponding ConditionalInstruction.Conditions array.
Month Determines the month that is compared with the condition's form field value.
TextComparisonFlags Determines how the specified comparison value has to be interpreted when comparing it with the TextFormField's or SelectionFormField's Text property.

Properties

Property Description
ComparisonOperator Gets the operator that is used to compare the condition's form field value with the specified comparison value.
ComparisonValue Gets the value that is compared with the condition's form field value.
ComparisonValueType Gets a value of type ComparisonValueTypes that determines how the condition's comparison value is interpreted.
FormField Gets the FormField whose property value is to be compared with the condition's comparison value.
LogicalConnective Gets or sets a value of type Condition.LogicalConnectives that describes how the condition is related to the previous condition inside the corresponding ConditionalInstruction.Conditions array.