Below is an example fetch Xml for retrieving the N:N associated records.
Where:
-N:N exists between entities: abc_customer and abc_contract.
-The intersect Entity Name: abc_abc_customer_abc_contract.
-Primary Keys of the abc_customer and the abc_contract are respectively: abc_customerid and abc_contractid.
-Records to be retrieved from Entity: abc_customer,
fields to retrieve :
abc_fullname, abc_title, abc_telephone1,abc_customerid
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
"<entity name='abc_customer'>"+
"<attribute name='abc_fullname' />"+
"<attribute name='abc_title' />"+
"<attribute name='abc_telephone1' />"+
"<attribute name='abc_customerid' />"+
"<order attribute='abc_fullname' descending='false' />"+
"<link-entity name='abc_abc_customer_abc_contract' from='abc_customerid' to='abc_customerid' visible='false' intersect='true'>"+
"<link-entity name='abc_contract' from='abc_contractid' to='abc_contractid' alias='aa'>"+
"<filter type='and'>"+
"<condition attribute='abc_contractname' operator='eq' value='PensionPlanInsuranceContract' />"+
"</filter>"+
"</link-entity>"+
"</link-entity>"+
"</entity>"+
"</fetch>"
Similar fetch can be used for retrieving N:N related records with higher depths.
Where:
-N:N exists between entities: abc_customer and abc_contract.
-The intersect Entity Name: abc_abc_customer_abc_contract.
-Primary Keys of the abc_customer and the abc_contract are respectively: abc_customerid and abc_contractid.
-Records to be retrieved from Entity: abc_customer,
fields to retrieve :
abc_fullname, abc_title, abc_telephone1,abc_customerid
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
"<entity name='abc_customer'>"+
"<attribute name='abc_fullname' />"+
"<attribute name='abc_title' />"+
"<attribute name='abc_telephone1' />"+
"<attribute name='abc_customerid' />"+
"<order attribute='abc_fullname' descending='false' />"+
"<link-entity name='abc_abc_customer_abc_contract' from='abc_customerid' to='abc_customerid' visible='false' intersect='true'>"+
"<link-entity name='abc_contract' from='abc_contractid' to='abc_contractid' alias='aa'>"+
"<filter type='and'>"+
"<condition attribute='abc_contractname' operator='eq' value='PensionPlanInsuranceContract' />"+
"</filter>"+
"</link-entity>"+
"</link-entity>"+
"</entity>"+
"</fetch>"
Similar fetch can be used for retrieving N:N related records with higher depths.
No comments:
Post a Comment