power-automatefetchxmldataverse

How to write fetchXml to get distinct data in dataverse connector


I am creating flow where I am using Data verse Connector and written fetchXml to get data from checklistquestionresponse, annotation and checklistasset entities, but in annotation holds multiple records for one checklistquestionresponse entity record due to which it show duplicate records, we just want to check if any record present in annotation entity for current query record of checklistquestionresponse entity. How can I do this, please refer below fetchXml query :

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="checklistquestionresponse">
<attribute name="checklistquestionresponseid" />
<attribute name="title" />
<attribute name="instructions" />
<attribute name="notes" />    
<attribute name="checklist" />
<order attribute="title" descending="false" />
<link-entity name="annotation" from="objectid" to="checklistquestionresponseid" link-type="outer" alias="ae">
     <attribute name="annotationid" />
</link-entity>
<link-entity name="checklistasset" from="checklistassetid" to="checklistasset" visible="false" link-type="outer" alias="checklistasset">
  <attribute name="name" />
</link-entity>
<filter type="and">
  <condition attribute="checklist" operator="eq" uitype="checklist" value="@{triggerOutputs()?'body/checklistid']}}" />
 <filter type="or">
 <condition attribute="notes" operator="not-null" />
 <condition entityname="ae" attribute="annotationid" operator="not-null" />
</filter>
  <filter type="or">
    <condition attribute="acceptableunacceptablerange" operator="eq" value="Acceptable" />
    <condition attribute="responsevalue" operator="eq" value="Acceptable" />
   </filter>
  </filter>
 </entity>
</fetch>

To resolve this problem what should I do, should I create multiple data verse connector, if I use multiple data verse connector how can i check into html table for each checklistquestionresponse entity record. enter image description here


Solution

  • You can use distinct="true" in your fetchXml to remove duplicates in the returned dataset.

    Check this blog out for some more information on how distinct works