0

I'm using JRules Studio to develop some extremely simple rules. The rules populate an IN_OUT parameter. When the test finishes, is there a way of interrogating the values in the IN_OUT object?

Initially I'd like to interrogate it in the debugger, but any other ideas would be welcomed.

DaveH
  • 7,187
  • 5
  • 32
  • 53
  • Can you add a little more detail? What exactly do you want to do after the rule execution? – sdfx Apr 18 '12 at 13:37

1 Answers1

0

I am not sure to understand the question:

Your JAVA code is like this:
IlrSessionFactory factory = new IlrJ2SESessionFactory();
IlrStatelessSession session = factory.createStatelessSession();
IlrSessionRequest sessionRequest = factory.createRequest();
sessionRequest.setRulesetPath(“/RuleAppName/rulesetName”);
sessionRequest.setTraceEnabled(true);
sessionRequest.getTraceFilter().setInfoAllFilters(true);
Map inputParameters = new HashMap ();
Report in_report = new Report(); // no-arg constructor
// ... populate the Object ...
inputParameters.put("report", in_report);
sessionRequest.setInputParameters(inputParameters);
IlrSessionResponse sessionResponse = session.execute(sessionRequest);
Report out_report = (Report)sessionResponse.getOutputParameters().get("report“);


And then you play with your "out" parameters... As you would do with any JAVA object

If you want to see them at debug time, I would say:

1/ (not tested) Have a look on the "working memory tab" in the debugger perspective
I am not sure but this is the easiest way to find them if it is visible here

2/ (tested) in the initial action of the starting point of your ruleflow, add:
context.insert(the technical name of your parameter);
Not the "business name". Anyway avoid using BAL in technical artifact such as ruleflow, IRL rules!

By doing this you force the engine to insert your parameter in the working memory.
No duplication (don't worry, it will work like a charm) but as far as I can remember this is the shortest way to make them visible in the Eclipse debugger in JRules

Hope it helps

Damien
  • 1,401
  • 9
  • 4
  • BTW: you can add breakpoint inside a rule itself. But only on the action part. This is due of the fact the engine doesn't necessarly knows what condition test is for which rule. In other words, the engine can ask a question like (user.age) and keep the response for the user question. Which make the engine to run faster and you don't keep on asking the same question all the time especially in a decision table for instance – Damien Apr 18 '12 at 15:19
  • Tip: if you want to know a value of a variable in the condition part then the trick is easy. Create a method in your BOM which return a boolean and simply print the parameter in the body of the method. :) – Damien Apr 18 '12 at 15:24