ilogjrulesibm-odm

ILOG dynamic ruleset


public void executeRules(IlrRule[] rules){
       IlrRuleset rulesetNew = new IlrRuleset();
       IlrContext ctxt = new IlrContext(rulesetNew);
       IlrTask task = ruleset.getTask("ExecFlow#exe");
       IlrRuleTaskRunner runner = ctxt.getRuleTaskRunner(task);
       runner.setActiveRules(rules);
       int fired = 0;
       runner.runInitialActions();
       fired += runner.runBody();
       runner.runFinalActions();

}

How we can create a dynamic ruleset from group of rules? this group is a dynamic. I am using IBM ODM 8.0.1


Solution

  • All Java implementation are disappeared, we used irl language, this is the solution :

    We defined the scope and we select the rules dynamically

    scope= {exe.R05,exe.R04,exe.R03}
    
    body = dynamicselect() {
        return selectedFunction(context.getRuleset().allRules);
    }