Hello,
I am attempting to iterate through multiple nodes in the Business Rules
Engine (BTS2004) and assign a sequence number to each existing node. I
am able to evaluate each individual occurrence of the node, and I’m
using a counter class variable (and IFactRetriever) to assign a
sequence number to each node. The nodes are being evaluated
individually, which is good, but they are not being evaluated
sequentially. I’ll include a small example below along with the XPath
statements I am using:
<Root>
<Group>
<View>
<Sequence_Number>0</Sequence_Number>
<Other_field>123</Other_field>
</View>
<View>
<Sequence_Number>0</Sequence_Number>
<Other_field>234</Other_field>
</View>
<View>
<Sequence_Number>0</Sequence_Number>
<Other_field>345</Other_field>
</View>
<View>
<Sequence_Number>0</Sequence_Number>
</View>
</Group>
</Root>
IF:
*[local-name()=’Other_field’ and namespace-uri()=”] exists in
DocumentType:/Root/Group/View
THEN:
DocumentType:/Root/Group/View/Sequence_Number = getCounterVariable
AND IncrementCounter()
When I have two nodes that exist, this works perfect, but when I have
something like the above example the sequence numbers are out of
order…here is the output:
<Root>
<Group>
<View>
<Sequence_Number>1</Sequence_Number>
<Other_field>123</Other_field>
</View>
<View>
<Sequence_Number>3</Sequence_Number>
<Other_field>234</Other_field>
</View>
<View>
<Sequence_Number>2</Sequence_Number>
<Other_field>345</Other_field>
</View>
<View>
<Sequence_Number>0</Sequence_Number>
</View>
</Group>
</Root>
Is there a \”quick and dirty\” way to force the BRE to evaluate these
nodes sequentially? If not, I know that I can at least write another
class to grab the nodes and evaluate them sequentially, but I would
prefer to use as little .net code in my business rules as possible.
Please let me know if you require further information.
Thanks in advance,
Cody