Overview
Most business rules built in the KRMS engine can be accommodated with the instruction from the Cross Module Functionality - KRMS Basic Rule Setup article. There are circumstances where more complex logic is required. There are a variety of ways to represent complex logic in the KRMS system.
Single Operator Compound Proposition
The most common, and simplest multi variable logic involves checking to see if multiple statements are either ALL correct, or if ANY of them are correct. This can be accomplished in KRMS using the AND, or OR operator.
The first step is to follow the steps in the Cross Module Functionality - KRMS Basic Rule Setup article. Once you have the first statement of your Proposition in place, press the Add button on your Proposition control panel again. This will add a second proposition, and default the operator to AND. If you wand to check to see if all of the logical statements you've setup are true leave this marked as AND. If you want to check to see if any of the logical statements you've setup are true, change the operand to OR. Next Click on the title of your parent proposition, which will be labeled New Compound Proposition and rename it to something descriptive. You can continue to add additional statements to this compound proposition, but they must all be either AND or OR. In the example below we are checking to see if either of 2 Questions on a Proposal are marked Yes. These are questions related to Biohazardous Materials.
Multi Operator Compound Proposition
In some cases you may want to use both AND and OR operands in a single operation. An example of this is if you want to check the two Biohazardous Questions above, and if either one is marked Yes AND Biohazardous Materials aren't included on the Compliance screen display an error message.
Once you have the logic described above, click on the Description of your compound proposition, and press the Add Parent button on your Proposition control bar.
This will embed the logic you've setup in a parenthetical statement, and add a new proposition outside the parenthesis. Any additional logic added inside the parenthesis must share the same operator you used above, but you may set a different operator outside of the parenthesis.
The example below: (is Biohazard Q1 Y OR is Biohazard Q2 Y) AND is Biohazard Included in Special Review false
If the Compound Proposition above is all true then you can fire an action such a validation error that states:
You have indicated that your project includes Biohazardous Materials in the Questionnaire. You must add a Biohazardous Materials entry to the Compliance page before submitting your proposal for review.
Multi Rule Compound Logic
There is a second way to setup the logic in the Parent/Child Compound Proposition above. You can also setup your Agenda so certain rules don't fire unless other Rules execute to true or false. This configuration allows you to setup multiple actions based on subsets of the logic, and this structure is easier for some users to keep track of.
Instead of embedding all of our logic in a single proposition, in this example we're going to finalize a rule with the Single Operator Compound Proposition above with the name One of the Biohazard Questions Marked Y. Then we will create a new rule called Biohazard Compliance Not Included. This rule will follow the process in the Cross Module Functionality - KRMS Basic Rule Setup article and execute to true when Special Review Type 5 is not included in the Proposal. This will use the Special Review Rule (_) function.
Once these two rules are setup we will use the direction buttons in the Agenda document to move the One of the Biohazard Questions Marked Y rule to just below Biohazard Compliance Not Included. This can be done with the Up and Down buttons.
Next click on the One of the Biohazard Questions Marked Y and press the Right button. This will indent the rule, and add a When False label between the two rules. Next click on One of the Biohazard Questions Marked Y and press the Up button. This will flip the When False label to When True.
Now the One of the Biohazard Question Marked Y rule will only execute when the Biohazard Compliance Not Included rule is true. You can now associate an action with each of these rules, which can help minimize the amount of KRMS setup needed if you need multiple actions to fire based on similar logic. This structure also helps create efficient KRMS performance if you have a large number of complex rules, since the rule terminates as soon as the highest level piece of logic executes as invalid.
Comments
0 comments
Article is closed for comments.