TheCondition Class |
Scroll |
TheCondition represents a boolean test to the value of an TheCategoryField. When defining a new TheQuery you may add one or more TheCondition objects to the TheConditionList exposed through the TheQuery.Conditions property.
Namespace: Therefore.API
Visual Basic Public Class TheCondition C# public class TheCondition |
Name |
Description |
Gets or sets the the condition string. |
|
Gets or sets the number of the field that the condition is applied to. |
|
Gets or sets if the condition is set as UTC value or not. For DateTime fields only. |
Name |
Description |
Returns a string representation of the TheCondition object |
Parsing and Validation TheCondition is only a data container class. It does not parse or validate the condition string by itself. When TheCondition is used in an TheQuery or TheMultiQuery all parsing and validation is done when the query is executed.
Using Column Names An TheCondition is not associated to a category. Therefore you cannot address the field by name. The TheConditionList, however, can be associated with an TheCategory and provides an Add method that allows you to create and add conditions using column names.
Condition Strings and Operators Condition strings can contain any value or operator valid for the associated field's type. Values 0-9 are valid for Currency and Number type fields, any alphanumeric text string for Text types, any date (in the local PC's date format) for Date fields or all valid keywords for keyword fields. The format used for decimal numbers (. or ,) and Date (mm/dd/yy, dd/mm/yy etc) are dependent on the local PC's (Windows O/S) default setting.
Functions can be combined to form complex search expressions. For example: ">4711 AND <=5607" searches for index data 'greater than' 4711 and 'smaller than or equal to' 5607. ">=4711 OR 2303" searches for index data 'greater than or equal to' 4711 or (equal to) 2303.
UTC and time zones By default all date and time values are considered to be in UTC, except it is specified otherwise by the IsUTC property or the bIsUTC parameter in TheConditionList.Add method overloads. If IsUTC is false, the time zone specified in TheCultureInfo.TimeZoneInfoID returned by TheServer.GetCultureInfo is used for UTC conversion internally. If no culture info has been set, the time zone of the current user context will be used. |
Visual Basic ' Condition evaluating if the value in field number 70 starts ' with a 1 (1, 11, ..., 123, ...) and/or is greater than 42 Dim condition As TheCondition = New TheCondition() condition.FieldNo = 70 condition.Condition = "1* OR > 42"
' Create a condition list and add the condition Dim conditionList As TheConditionList = New TheConditionList() conditionList.Add(condition)
' Assign the condition list to a query Dim query As TheQuery = New TheQuery() query.Conditions = conditionList C# // Condition evaluating if the value in field number 70 starts // with a 1 (1, 11, ..., 123, ...) and/or is greater than 42 TheCondition condition = new TheCondition(); condition.FieldNo = 70; condition.Condition = "1* OR > 42";
// Create a condition list and add the condition TheConditionList conditionList = new TheConditionList(); conditionList.Add(condition);
// Assign the condition list to a query TheQuery query = new TheQuery(); query.Conditions = conditionList; |