Relationship Search Criteria

You can search the record based on:

  • Relationship attributes of any relationship defined for current repository
  • Existence of related records
  • Count of related records (for example, a customer which has two associated banks)
  • Attributes from target repository.

The RelationshipData tag defines how to specify the relationship criteria for the repository. For example:

<Transaction>
<Command type="Query">
<StartCount>1</StartCount>
<MaxCount>1000</MaxCount>
<MasterCatalogRecord etype="Entity">
<!-- Base master catalog attributes -->
<ExternalKeys>
<Key name="MASTERCATALOGNAME" type="string">Customer</Key>
<Key name="PRODUCTID">a2</Key>
<Key name="PRODUCTIDEXT">a2</Key>
<Key name="FIRSTNAME">John</Key>
</ExternalKeys>
<!-- Relationship search criteria -->
<RelationshipData>
<!-- flags exists , count -->
<Relationship checkExistence ="true" count="2">
<RelationType>CustomerAccount</RelationType>
<!-- Relationship attributes -->
<RelationshipAttributes>
<Attribute name="type">SAVING</Attribute>
</RelationshipAttributes>
<!-- target master catalog attributes.-->
<Record>
<ExternalKeys>
<Key name="BALANCE" >39000</Key>
</ExternalKeys>
<!-- second level relationship search -->
<RelationshipData>
<Relationship checkExistence ="false">
<RelationType>AccountAddress</RelationType>
<RelationshipAttributes>
<Attribute name="preferred">Y</Attribute>
</RelationshipAttributes>
<Record>
<ExternalKeys>
<Key name="CITY">San Jose</Key>
</ExternalKeys>
</Record>
</Relationship>
</RelationshipData>
</Record>
</Relationship>
</RelationshipData>
</MasterCatalogRecord>
</Command>
</Transaction>
Record Query - Keys
Key Name Meaning Mandatory
RelationType Relationship name Yes
checkExistence This is optional flag which allows to search based on existence or non-existence of a relationship. Valid values are true, false (means does not exists) No. Default is Yes.
count Count of related records No
RelationshipAttributes The criterion for relationship attributes can be specified using Attribute key.

For example:

<Attribute name="ACCOUNT_TYPE">SAVING</Attribute>
No
Record The criterion for target repository attributes can be specified using ExternalKeys tag (the name of the attribute and its value needs to be specified).

For example:

<Record>
<ExternalKeys>
<Key name="CITY">San Jose</Key>
</ExternalKeys>
</Record>
No