Hi Everybody,
I met a problem about the construction of a FetchXML query :
My need is to get the result of this SQL Query :
SELECT DISTINCT Contact.ContactId FROM Contact LEFT OUTER JOIN grd_contact_ensemble INNER JOIN grd_ensemble ON grd_ensemble.grd_ensembleId = grd_contact_ensemble.grd_ensembleid ON Contact.ContactId = grd_contact_ensemble.Contactid LEFT OUTER JOIN grd_address INNER JOIN grd_communecp ON grd_communecp.grd_communecpId = grd_address.grd_PostalCodeId ON Contact.ContactId = grd_address.grd_ContactId WHERE grd_ensemble.grd_code = 'A04024' OR grd_communecp.grd_cp LIKE '91220%' OR grd_communecp.grd_cp LIKE '05%'
I tried to write somthing like this, but it seems that the usage of relation into fetch xml are limited:
In fact the clause WHERE OR between attributes of differents ralated entities seems to be impossible ?
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" ><entity name="contact" ><attribute name="contactid" /><link-entity name="grd_address" from="grd_contactid" to="contactid" alias="ae" link-type="outer" ><link-entity name="grd_communecp" from="grd_communecpid" to="grd_postalcodeid" alias="af" ><filter type="and" ><filter type="or" ><condition attribute="grd_cp" operator="like" value="91220%" /><condition attribute="grd_cp" operator="like" value="05%" /></filter></filter></link-entity></link-entity><link-entity name="grd_contact_ensemble" from="contactid" to="contactid" visible="false" intersect="true" link-type="outer" ><link-entity name="grd_ensemble" from="grd_ensembleid" to="grd_ensembleid" alias="ag" ><filter type="and" ><condition attribute="grd_code" operator="eq" value="A04024" /></filter></link-entity></link-entity></entity></fetch>
Do you have any ideas about this issue ?
Thx in advance for your precious help :)
Kya