book
Article ID: KB0086802
calendar_today
Updated On:
Description
Resolution:
See the attached sample project and the jar files (copy these in your <tibco>/<beinstall>/hotfix folder.
The sample project loads a scorecard with an array of three conditions on engine startup:
Conditions.ConditionValues[0] = " == 10";
Conditions.ConditionValues[1] = " > 70";
Conditions.ConditionValues[2] = "String b = 'green'; a == b;";
- Defines two rules; one rule will fire when the condition is true, the other rule will fire when the condition is false. The rules use a
custom function in the rule condition called evalStringCondition().
- Defines an event that takes the condition LHS and the index of the preloaded condition to compare it against.
Build the ear file, and then run the sendConditionsToTest BW process. For example, the process will send the value "10" and the index 0 to BE.
BE will then concatenate the value to the preloaded indexed condition to come up with "10 == 10". This will evaluate to true (using the custom
function), and the "conditionIsTrue" rule will fire.
This would allow you to load conditions from an external source (e.g.database), and then have a rule that takes the LHS from an event, and
compares the value against a particular condition.
NOTE:
----
Strings are a little different. You need to declare the values as strings, and then specify the operation (e.g. ==, !=, etc.)
Issue/Introduction
How to evaluate conditions dynamically in a RuleFunction? Is there an example to illustrate the same?