Using Propagation in Rulebases to validate / update Records in a Record Tree from the Root Record's rulebase
book
Article ID: KB0076739
calendar_today
Updated On:
Description
When editing a root record in a modify or correction operations, records underneath the root (in a record tree can be validated / updated using propagation element in the root record's rulebase : these propagation rules can appear not just in the root record's catalogvalidation rulebase, but all rulebases to which values are propagated, allowing validations to performed across a whole tree of related records.
Issue/Introduction
When editing a root record in a modify or correction operations, records underneath the root (in a record tree can be validated / updated using propagation element in the root record's rulebase : these propagation rules can appear not just in the root record's catalogvalidation rulebase, but all rulebases to which values are propagated, allowing validations to performed across a whole tree of related records.
Environment
MDM - all versions
Resolution
As an example, given:
* an enterprise ENT1
* a PARENT repository with ID 34343
* a CHILD repository with an attribute VALUEONE
* a GRANDCHILD repository with an attribute VALUEONE
* a relation PTOC between PARENT and CHILD repositories owned by the PARENT repository
* a relation CTOG between the CHILD and GRANDCHILD repositories owned by the CHILD repository
the following structure checks the CHILD repository attribute VALUEONE and GRANDCHILD repository attribute VALUETWO are defined (not null) when the PARENT is VALIDATED:
PARENT catalogvalidation.xml rulebase:
<?xml version="1.0" encoding="UTF-8"?>
<rulebase metaversion="1.0">
<name>Catalog Validations</name>
<description>Catalog Validations</description>
<execution_directive first_pass="required"/>
<declare usage="regular">
<var>PTOCRELREC</var>
<link type="relationship_record">
<literal>PTOC</literal>
</link>
</declare>
<constraint>
<name>PropagateChecksToChild</name>
<description>Check child records accessed via PTOC</description>
<usefor></usefor>
<action>
<propagate type="rulebase">
<var>PTOCRELREC</var>
<literal>ENT1/catalog/master/34343/CheckChild.xml</literal>
</propagate>
</action>
</constraint>
</rulebase>
Included CheckChild.xml rulebase:
<?xml version="1.0" encoding="UTF-8"?>
<rulebase metaversion="1.0">
<name>Catalog Validations</name>
<description>Catalog Validations</description>
<execution_directive first_pass="required"/>
<declare usage="regular">
<var>CTOGRELREC</var>
<link type="relationship_record">
<literal>CTOG</literal>
</link>
</declare>
<constraint>
<name>CheckMandatory</name>
<description>Check mandatory values present</description>
<usefor><var>VALUEONE</var></usefor>
<action>
<check>
<explanation>Mandatory value missing</explanation>
<defined><var/></defined>
</check>
</action>
</constraint>
<constraint>
<name>PropagateChecksToGrandchild</name>
<description>Check grandchild records accessed via CTOG</description>
<usefor></usefor>
<action>
<propagate type="rulebase">
<var>CTOGRELREC</var>
<literal>ENT1/catalog/master/34343/CheckGrandchild.xml</literal>
</propagate>
</action>
</constraint>
</rulebase>
Included CheckGrandchild.xml rulebase:
<?xml version="1.0" encoding="UTF-8"?>
<rulebase metaversion="1.0">
<name>Catalog Validations</name>
<description>Catalog Validations</description>
<execution_directive first_pass="required"/>
<constraint>
<name>CheckMandatory</name>
<description>Check mandatory values present</description>
<usefor><var>VALUETWO</var></usefor>
<action>
<check>
<explanation>Mandatory value missing</explanation>
<defined><var/></defined>
</check>
</action>
</constraint>
</rulebase> Values from the PARENT to the CHILD rulebase, and from the CHILD to the GRANDCHILD rulebase can also be propagated by preceding the relevant attribute with LINK/. So, for example, to assign the value of VALUEP from the PARENT record to the attribute VALUEC in the child record
PARENT catalogvalidation.xml rulebase:
<?xml version="1.0" encoding="UTF-8"?>
<rulebase metaversion="1.0">
<name>Catalog Validations</name>
<description>Catalog Validations</description>
<execution_directive first_pass="required"/>
<declare usage="regular">
<var>PTOCRELREC</var>
<link type="relationship_record">
<literal>PTOC</literal>
</link>
</declare>
<constraint>
<name>PropagateChecksToChild</name>
<description>Check child records accessed via PTOC</description>
<usefor></usefor>
<action>
<propagate type="rulebase">
<var>PTOCRELREC</var>
<literal>ENT1/catalog/master/34343/CheckChild.xml</literal>
</propagate>
</action>
</constraint>
</rulebase>
Included CheckChild.xml rulebase:
<?xml version="1.0" encoding="UTF-8"?>
<rulebase metaversion="1.0">
<name>Catalog Validations</name>
<description>Catalog Validations</description>
<execution_directive first_pass="required"/>
<declare usage="regular">
<var>CTOGRELREC</var>
<link type="relationship_record">
<literal>CTOG</literal>
</link>
</declare>
...
<constraint>
<name>AssignParentValueToChild</name>
<description>Assign Parent Value to Child Attribute</description>
<usefor></usefor>
<action>
<assign>
<var>VALUETWO</var>
<var>LINK/VALUEONE</var>
</assign>
</action>
</constraint>
</rulebase>
The same is done in MDM Studio by using the propagate element, as in:
Attached is the MDM Studio 5.1.0 project "ENT1" shown above.
Attachments
Using Propagation in Rulebases to validate / update Records in a Record Tree from the Root Record's rulebase
get_app
Feedback
thumb_up
Yes
thumb_down
No