This blog is a part of the series regarding the features in BRM. Other blog in the series is “Understanding the feature – Priority”. In this blog I wish to answer the general question which comes to one’s mind while creating conditions in a Decision Table – What are the different comparators which can be used to create a meaningful condition?
I have tabularized the whole collection of comparators supported and a brief write-up about how it can be used –
Comparator | How to use |
In | Can be used in condition values in the following format: In a,b,c A condition gets satisfied if its LValue equals any one of the comma separated values which follow “In” comparator. Example - In 200,300,300 (for numeric values such as for int, float, double, etc.,) In Good, Bad, Moderate (for enum type where only the existing enum values can be assigned to the condition) ‘In’ comparator can be used with all except Boolean data type. A condition gets satisfied if the input value equals any one of the comma separated values which follow “In” comparator. |
Not In | Can be used in condition values in the following format : Not In a,b,c “Not In” comparator can be used both in strings and numeric condition values. “Not In” comparator can be used with all except Boolean data type. |
Between | Can be used in condition values in the following format: Between 5 and 10. It is inclusive of boundary values. “Between” comparator can be used for numeric value but not for string condition value. |
Like | Can be used in condition values in the following formats: Like a Like * Like ab* Like ab*c* Like ab*c*d*ee “Like” comparator looks for a pattern-match between LValue of the condition and the value that follows it. If Lvalue of a condition is “abcdef”, then following are the expected results: Like * returns true Like ab* returns true Like ab*e returns false Like ab*d* returns true This comparator can only be used with string condition value but not with numeric condition value. |
Not Like | Can be used in condition values in the following formats: Not Like a Not Like * Not Like ab* Not Like ab*c* Not Like ab*c*d*ee “Not Like” operator looks for a pattern-mismatch between LValue of the condition and the value that follows it. If LValue of a condition is “abcdef”, then following are the expected results: Not Like * returns false Not Like ab* returns false Not Like ab*e returns true Not Like ab*d* returns false This operator can only be used with string condition value but not with numeric condition value. |
>, >= , <, <= | Can be used in condition values in the following format: > 10 > = 10 < 20 < = 20 The Logical operator ‘and’ can be used in conjunction as follows: >10 and <20 (OR) >=10 and <=20 (Same as Between) These comparators can be used with all except Boolean data type. We can use “or” logical operator also. We can give complex ranges such as: ((>=10 and <=20) OR (>=40 and <=50)) |
= | Can be used in condition values in the following format: = A Where, A can be a string or a numerical or a Boolean value. = 20 = Joe = true For Boolean this is the only comparator that is supported. |
!= | Can be used in condition values in the following format: !=20 (numeric condition value) !=Joe (String condition value) This comparator can be used for String and numeric types. |