2014-01-31 4 views
1

소유자가있는 비즈니스와 기회가 성공할 확률을 기반으로 모든 레코드를 반환하는이 FetchXML 쿼리가 있습니다. 보고하는 모든 입력란은 필수 입력란입니다. 내가 가지고있는 문제는 내 연결된 계정 중 하나입니다. "new_dealerid"계정이 항상 채워지지 않을 수도 있습니다. 포함 시키면 31 개의 레코드 만 가져올 수 있습니다 (모두 대리점 있음). 그렇지 않으면 32 개가됩니다. (새로운 제품에는 딜러가 없습니다). 그래서 누군가가 빈 문자열이나 뭔가 관련 속성이 없다면이 속성을 기본값으로 만드는 방법을 알고 있습니까?FetchXML - 레코드가 반환되지 않습니다.

<request i:type="b:RetrieveMultipleRequest" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> 
      <b:Parameters xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic"> 
       <b:KeyValuePairOfstringanyType> 
        <c:key>Query</c:key> 
        <c:value i:type="b:FetchExpression"> 
         <b:Query>&lt;fetch mapping="logical" version="1.0" &gt;&#xD; 
          &lt;entity name="opportunity"&gt;&#xD; 
           &lt;attribute name="estimatedvalue" /&gt;&#xD; 
       &lt;attribute name="name" /&gt;&#xD; 
       &lt;attribute name="new_opportunitytype" /&gt;&#xD; 
       &lt;attribute name="new_salesphase" /&gt;&#xD; 
       &lt;attribute name="estimatedclosedate" /&gt;&#xD; 
       &lt;link-entity name="systemuser" from="systemuserid" to="ownerid"&gt;&#xD; 
        &lt;attribute name="fullname"/&gt;&#xD; 
       &lt;/link-entity&gt; 
       &lt;link-entity name="account" from="accountid" to="new_dealerid"&gt;&#xD; 
        &lt;attribute name="name"/&gt;&#xD; 
       &lt;/link-entity&gt; 
       &lt;link-entity name="account" from="accountid" to="customerid"&gt;&#xD; 
        &lt;attribute name="name"/&gt;&#xD; 
       &lt;/link-entity&gt; 
       &lt;filter type="and"&gt; 
       &lt;condition attribute="salesstagecode" operator="eq" value="'.$prob.'" /&gt; 
       &lt;condition attribute="statuscode" operator="eq" value="1" /&gt; 
       &lt;/filter&gt; 
       &lt;link-entity name="systemuser" from="systemuserid" to="ownerid"&gt;&#xD; 
        &lt;link-entity name="businessunit" from="businessunitid" to="businessunitid"&gt;&#xD; 
       &lt;filter type="and"&gt; 
        &lt;condition attribute="name" operator="eq" value="'.$bu.'" /&gt; 
       &lt;/filter&gt; 
       &lt;/link-entity&gt; 
       &lt;/link-entity&gt; 
          &lt;/entity&gt;&#xD; 
         &lt;/fetch&gt;</b:Query> 
        </c:value> 
       </b:KeyValuePairOfstringanyType> 
      </b:Parameters> 
      <b:RequestId i:nil="true"/><b:RequestName>RetrieveMultiple</b:RequestName> 
    </request> 

답변

1

분명히하기 위해 32 개의 레코드를 모두 가져 오시겠습니까?

외부 결합을 사용해야합니다.

<link-entity name="account" from="accountid" to="new_dealerid" link-type="outer"> 
+1

결국 작업으로 인해 new_dealerid가 속성으로 사용되었습니다. 하지만 fetchXml의 링크 유형에 대해 알아두면 좋습니다. 감사합니다. –

관련 문제