In a procedural engine, multiple procedures can be interlinked. This means that a procedural rule can execute another rule; thus, the context of the parent rule can be shared, and the result can be copied back to the root context. Different scenarios can be managed in several ways.
- Description: Sets the context for the called procedure
- Mandatory: Yes
- New: Creates a new context and uses such context for execution; in this case, the variable of the new context must be registered by the Param command
- Shared: Uses the current context for execution and the new procedure after finishing the procedure execution; the current execution variable context (of only out-variables) is copied to the original one
- Description: This attribute is set when the target procedure has variables that need to be accessed via the root executing procedure.
- Mandatory: Yes
- None: Does not copy
- AddOut: Copies out-variables
- AddIn: Copies in-variables
- AddBoth: Copies both in- and out-variables
This command passes a value to the procedure and registers new variables in a new context if required.
This command provides the rule with a source to be loaded and executed. It can be a relative or absolute file path or a RuleSet address. If it is a relative file path, the location is initiated from your application’s execution folder. If it is a RuleSet address, it should be a valid address, and the engine should be initialized using RuleSet overload.
<CallProc contextMode="Shared" resultCopyMode="AddOut" >
<ProcSource uri="Rules/Ver2/CalculatePriceSubTotal.xml" />
When we use contextMode="New" we need to pass the
required parameter for the target procedure, otherwise
all of the variables are shared in the main procedure and do
not need to pass <Param .... />
<Param name="StarQty" ref="StarQty"/>
<Param name="GoldQty" ref="GoldQty"/>
<Param name="SilverQty" ref="SilverQty"/>
<Param name="StarQtyDiscount" ref="StarQtyDiscount"/>
<Param name="GoldQtyDiscount" ref="GoldQtyDiscount"/>
<Param name="SilverQtyDiscount" ref="SilverQtyDiscount"/>