Controlling the Relationships Shown for an Item

While creating a record and associating it with other records, you can control which relationships apply at a specific step or level.

For example, for the main record, all relationships may be valid but for the associated child record, only some of the relationships may apply. You can also control the order in which relationships are listed.

Procedure

  1. For each relationship type you include for an item, define a constraint in the catalogvalidation.xml file. This file shows relationships for items in all repositories.
  2. To include a relationship type that is different from relationships in the rest of the repositories, add a constraint (specific to the repository) to the CatalogValidation.xml file. The file is located in the MQ_COMMON_DIR/ <enterprise IternalName>/catalog/master/<specific repository ID> directory.
  3. To define this constraint:
    1. Declare a variable named RELATIONSHIP_LIST, with the usage attribute declared as "output".
      <declare usage="output">
        <var>RELATIONSHIP_LIST</var>
      </declare>
    2. Declare a variable named RECORD_ACTION.
      <declare>
         <var>RECORD_ACTION</var>
      </declare>
    3. In the <name> element of the constraint, name the type of relationship you want to include. In the description element of the constraint, enter a description.
    4. Define a condition element, similar to other conditions defined for other constraints in the Rulebase.
    5. To show a different relationship list for RECORD_ACTION, define a separate constraint. The possible values for this RECORD_ACTION constraint are ADD, EDIT, and COPY. Optionally, you can use record attributes to control the list of valid relationships.
    6. Define an action element for this condition, to assign the "RELATIONSHIPLIST" output variable. The following code sample defines a constraint for the 'Contains' relationship. You can add constraints for all of the relationships that you want to include for an item.
      <constraint>
       <name>contains</name>
       	<description>
       	Default relationship if Record Action 
       	is"ADD" or "EDIT" or "COPY" 
       	</description>
       <condition>
       	<or>
       	<eq>
       		<var>RECORD_ACTION</var>
       		<const type="string">ADD</const>
       	</eq>
       	<eq>
       			<var>RECORD_ACTION</var>
       			<const type="string">EDIT</const>
       	</eq>
       	<eq>
       			<var>RECORD_ACTION</var>
       			<const type="string">COPY</const>
       	</eq>
       		<eq>
      <!-Does Record_type attribute has value of VENDOR?>
      			<var>RECORD_TYPE</var>
       		<const type="string">VENDOR</const>
       	</eq>
       	</or>
       </condition>
       <action>
       		<assign>
       	<var>RELATIONSHIP_LIST</var>
       	<const type="string">CONTAINS</const>
       	<const type="string">CONTAINEDBY</const>
       		</assign>
      </action>
      </constraint>
  4. To show a relationship that is specific to RECORD_ACTION ='EDIT', define the constraint as "a general constraint that applies to RECORD_ACTION = 'ADD' or 'COPY.

Result

<constraint>
<name>contains</name>
 	<description>
 	Default relationship if Record Action is "ADD" or
 	or "COPY"
 	</description>
<condition>
<or>
<eq>
 	<var>RECORD_ACTION</var>
 	<const type="string">ADD</const>
</eq>
<eq>
 		<var>RECORD_ACTION</var>
 		<const type="string">COPY</const>
</eq>
	</or>
</condition>
 	<action>
<assign>
 	<var>RELATIONSHIP_LIST</var>
 	<const type="string">CONTAINS</const>		
 	<const type="string">CONTAINEDBY
 	</const>
 	</assign>
</action>
</constraint>

The following constraint is specific to the EDIT action:

<constraint>
<name>containsforEdit</name>
<description>
Default relationship if Record Action is "EDIT"
</description>
<condition>
<eq>
 	<var>RECORD_ACTION</var>
 	<const type="string">EDIT</const>
</eq>
</condition>
<action>
<assign>
 	<var>RELATIONSHIP_LIST</var>
 	<consttype="string">CONTAINS</const>
</assign>
</action>
</constraint>