Question

I am using NxBRE rules engine, and need to be able to check whether some value is in the list. Here is what I try:

Defining the list elements:

<String  id="Element1" value="Value1"/>
<String  id="Element2" value="Value2"/>
<String  id="Element3" value="Value3"/>
<String  id="Element4" value="Value4"/>

Checking the condition:

<In valueId="ValueId" idList="Element1, Element2, Element3, Element4">
  <ObjectLookup id="ValueId" objectId="MyObject" member="GetValue">
    <Argument valueId="MyArgument"/>
  </ObjectLookup>
</In>

ObjectLookup works OK, but the condition never evaluates to true, as I see from the results of the whole set execution.

I.e., if I change In ... valueId ... idList to mere Equals ... leftId ... rightId, leave only one id to check against (say, Element4) and make up a test so that I am sure that my value equals Value4, I see expected results, which proves that ObjectLookup works correctly here.

So the questions are:

  1. What I am doing wrong, i.e. why in the same test, where I know that value equals Value4, In does not evaluate into true?

  2. Can I do it in a more simple way. I.e., specify a constant list and use it, instead of specifying elements one by one and then constructing list from them?

  3. Is there any good documentation for NxBRE, so I do not have to ask such basic question?

Was it helpful?

Solution

  1. Looking at the XSL-T that transforms XBRE rules in BRE ones, I think you need to drop the spaces and just use commas to separate the IDs. The example in /Rulefiles/text.xbre works with comma separated IDs.

  2. You could use a regexp, like: (Element1|Element2|Element3|Element4)

  3. There's nothing besides the provided User Guide (PDF) and the online knowledge base. Studying /Rulefiles/text.xbre should also enlighten you somewhat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top