Business Rules Recommendations
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords">
business rules, recommendations, operators, operator, business rules recommendations
</keywords>
Business Rules Recommendations
The following recommendations are to be taken into account when creating Business Rules:
1. The name of the variables created within a rule should be all declared at the beggining of the rule in the PLAY shape.
2. Variables should always be initialized. If you are not sure of the initial value type null.
3. Always document your rules.
The texts that appear in a line proceeded by “//”, or within a block “/* … */”, are introduced for documentation effects. These lines should be added or modified for the rule carried out to be properly documented. This way anyone can understand the purpose of the rule.
4. The funtion ToString used in .NET must be used with lower t, that is: toString() to be able to be used in .NET and JEE Editions.
5. To set DateTime.Today or DateTime.Now always use Me.setXPath("").
For example:
Me.setXPath("Request.InitialDate",DateTime.Now)
6. Always use the CHelper.IsNull() function to make comparisons with a null value.
For example:
if (CHelper.IsNull(<PurchaseRequest.RequestObservation>))
7. Scripting Booleans should ALWAYS return true or false.
8. The following is the list of operators used in the rules:
Operator |
Name |
Example |
=
|
Assignment
|
<Name> = 'Carolina' Assigns the text Carolina to the attribute Name |
+
|
Plus
|
Days = <DaysTask> + 1; Adds the value of 1 to the value of the DaysTask attribute of and assigns it to the Days variable |
*
|
Times
|
<DaysTask> = <DaysTask> * 3; Assigns the current value of DaysTask multiplied by 3 as the new value of DaysTask |
-
|
Minus
|
Days = <DaysTask> - 1; Subtracts the value of 1 from the value of the DaysTask and assigns it to the Days variable |
/
|
Divided by |
Days = <DaysTask> /3 ; Divides the value of the DaysTask attribute by 3 and assigns it to the Days variable |
==
|
Equals |
<Name> == 'Caroline' Checks to see if the value of the Name attribute is equal to Caroline. Returns true or false |
!=
|
Other than |
<Name> != 'Caroline' Checks to see if the value of the Name attribute is NOT Caroline. Returns true or false<span /> |
>
|
Greater than |
<DaysTask> > 3 Checks to see if the DaysTask value is greater than 3. Returns true or a false |
<
|
Less than |
<DaysTask> < 3 Checks to see if the DaysTask value is less than 3. Returns true or a false |
>= |
Greater than or equal to |
<DaysTask> >= 3 Checks to see if the DaysTask value is greater than or equal to 3. Returns true or a false |
<=
|
Less than or equal to |
<DaysTask> <= 3 Checks to see if the DaysTask value is less than or equal to 3. Returns true or a false |
&& |
and
|
<WaitingTime> == 1 && <DaysTask> >= 3 Checks if the Attribute WaitingTime is 1 AND DaysTask is greater than or equal to three. It is true when both conditions are met |
||
|
or |
<WaitingTime>== 3 || <DaysTask> >= 1 Checks if the Attribute WaitingTime is 3 OR DaysTask is greater than or equal to one. It is true when any of conditions are met |
<comments />