See Also Send us your Feedback
BeeGrid Basics - Condition Objects
 

SGCondition object encapsulates a simple condition expression used by group calculations, filters and conditional styles. Condition expression has following form:

LhsValue operator (RhsValue1, RhsValue2)

LhsValue (left-hand-side value) is a value defined by the object that uses condition. For example, in conditional style, LhsValue is a value of the cell to which conditional style is applied.

RhsValue1 and RhsValue2 (right-hand-side values) are values stored in the condition object. These values are compared with the LhsValue. RhsValue2 is used only if sgOpBetween or sgOpCallback operator is specified.

Operator can be one of following constants:

sgOpFalse Always fail.
sgOpTrue Always succeed.
sgOpLessThan Succeeds if the left-side value is smaller then the right-side value.
sgOpLessThanOrEqual Succeeds if the left-side value is smaller than or equal to the right-side value.
sgOpGreaterThan Succeeds if the left-side value is greater then the right-side value.
sgOpGreaterThanOrEqual Succeeds if the left-side value is greater then or equal to the right-side value.
sgOpEqual Succeeds if the left-side value is equal to the right-side value.
sgOpBetween Succeeds if the left-side value is both greater then the first right-side value and smaller or equal to the second right-side value.
sgOpContains Succeeds if left-side value is contained in the right-side value. Applies only to string and integral (byte, short, long) types.
sgOpRegEx Succeeds if regular expression is matched. Applies only to string values.
sgOpCallback Uses the custom IsgConditionTest interface to test an LhsValue value. RhsValue1 should be an object that implements IsgConditionTest interface. RhsValue2 is a Tag value passed as the Test method's Tag parameter.
sgOpNot Negate operator. Can be used only in a combination with some other operator.



Along with Operator, Value1 and Value2 (rhs values) properties, SGCondition object has the CaseSensitive property that indicates whether string comparation is case-sensitive. Also, you can use the GetDefinition and SetDefinition methods to save and load comparation expression as an XML string.

See Also

SGCondition