Grouping records with the same name, without explicitly naming each one in an xml function



Firstly please accept my apologies. I have no previous experience with XML. I have been given some software that has an XML configuration file, the software takes data and looks for items that match.


The problem: Users are able to manually match records, but there is nothing in place to stop them matching records where the names don't match.


The syntax that allows a user to manually match a record is this:



<action name="ACCEPT">
<rules>
<rule>
<![CDATA[${AtLeastOneOfEach} and (abs(${TotalNetAmount}) <= decimalLimit("NetAmountLimit"))]]>
</rule>
</rules>
</action>


To look at correcting this issue I have loaded some sample data into a test environment where one match contains a client with the name "John". I have then created a function like this:



<function>
<name>AllAreJohn</name>
<description>match contains all clients called John</description>
<rule>
<![CDATA[(all have Client_Name="John") ]]>
</rule>
</function>


Using this function I have then edited the manual action to as follows:



<action name="ACCEPT">
<rules>
<rule>
<![CDATA[${AllAreJohn} and (abs(${TotalNetAmount}) <= decimalLimit("NetAmountLimit"))]]>
</rule>
</rules>
</action>


Working through my example, the above seems to work - where the client name is "John" (and the other criteria are fulfilled).


The question: Is there a way to re-write the XML function so that I don't have to declare the client name each time. I basically want the function to ensure that a group can only be formed when all the client names are the same.


Hope this makes sense. Many thanks for looking and in advance for any help you may be able to provide.


No comments:

Post a Comment