Is it possible to perform function call as in normal programming languages using Corticon? - Forum - Corticon - Progress Community

Is it possible to perform function call as in normal programming languages using Corticon?

 Forum

Is it possible to perform function call as in normal programming languages using Corticon?

This question is not answered

Here for my project, I need a rule sheet to be called for some particular function in between a rule sheet is processing.

As similar as we perform parameterized function call, which will be returning back to the main function.

All Replies
  • No. you cannot directly call a single rulesheet from within a rulesheet.
    (At least not today. It's an idea we have considered but it's not currently available)

    Rather than trying to call a rule sheet in the middle of executing another rule sheet you could:
    1. Execute that rule sheet before your main sheet (if you need to test some of its computed values in the main sheet ) or
    2. Execute that rule sheet after the main sheet ( by setting an appropriate flag in the main sheet and then testing it in a precondition in the other sheet)
    In both these cases the rule sheet uses the same vocabulary as the main rule.

    Another (more complex) approach is to call it indirectly by creating an extended operator in Java that makes a call to another decision service that contains the rule sheet(s).
    In this approach you can have a completely different vocabulary if necessary.
    Extended operators can only return single values, but they can have many input parameters.

    If you need to return multiple values from a call to an external function then you'd need to use the service callout mechanism. But you cannot call that from within a rule sheet. It has to be between rule sheets on the rule flow diagram.
    In general you do not want the values of attributes to be changing due to functions beyond the rule sheet's control otherwise you may defeat the rule sheet integrity checks.