Hello All, How can we use like java reflexion in SAIL to can call dyn

Hello All,

How can we use like java reflexion in SAIL to can call dynamically a rule expression or function from a rule expression?
For example something like that: invoke("rule!name",{param1;param2})
If it´s not ootb is there any plugin to do that?

thank you in advance for you answer,
Best regards.
Alex

OriginalPostID-183169

OriginalPostID-183169

  Discussion posts and replies are publicly visible

Parents
  • An example: Create a rule named TEST_DYNAMICALLY_CALL_RULE with input params 'ruleOrFunref'(Any Type) and ''params (Number - array)'. Define the rule as: ri!ruleOrFunRef(ri!params). Now you can call this rule from another rule and pass the function or ruleName. For eg: you can call it like this:
    rule!TEST_DYNAMICALLY_CALL_RULE(
    fn!sum,
    {1,2,3}
    ).

    So, here we are passing a rule reference to another rule with the parameters required. This paradigm is quite common in Functional Programming languages(en.wikipedia.org/.../Functional_programming) where a function takes other functions as arguments or returns a function (languages like LISP, JavaScript, Haskell, Clojure etc. support this.) I hope this is exactly what you wanted to know about.
Reply
  • An example: Create a rule named TEST_DYNAMICALLY_CALL_RULE with input params 'ruleOrFunref'(Any Type) and ''params (Number - array)'. Define the rule as: ri!ruleOrFunRef(ri!params). Now you can call this rule from another rule and pass the function or ruleName. For eg: you can call it like this:
    rule!TEST_DYNAMICALLY_CALL_RULE(
    fn!sum,
    {1,2,3}
    ).

    So, here we are passing a rule reference to another rule with the parameters required. This paradigm is quite common in Functional Programming languages(en.wikipedia.org/.../Functional_programming) where a function takes other functions as arguments or returns a function (languages like LISP, JavaScript, Haskell, Clojure etc. support this.) I hope this is exactly what you wanted to know about.
Children
No Data