【发布时间】:2019-07-23 20:41:12
【问题描述】:
我想返回一个父记录(报价单)及其所有子记录(报价单详细信息 + 链接实体产品),以便在使用 Fetch XML 的报告中使用。我目前使用的是父报表-子报表结构,但我需要访问存储在父报表中的产品上的数据。
我试图创建一个适合这种情况的 Fetch XML 查询,但我只能编写一个查询,该查询返回预过滤的 Quote 标头但所有 Quote 详细信息,无论它属于哪个报价。
当前父报告获取 XML:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="quote" enableprefiltering="1" prefilterparametername="CRM_FilteredQuote">
<attribute name="name" />
<attribute name="customerid" />
<attribute name="statecode" />
<attribute name="totalamount" />
<attribute name="discountpercentage" />
<attribute name="description" />
<attribute name="new_productsubgroupid" />
<attribute name="new_masterproductgroupid" />
<attribute name="quotenumber" />
<attribute name="ownerid" />
<attribute name="createdon" />
<attribute name="quoteid" />
<attribute name="effectiveto" />
<attribute name="effectivefrom" />
<order attribute="quotenumber" descending="true" />
</entity>
</fetch>
当前子报告获取 XML:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="quotedetail">
<attribute name="productid" />
<attribute name="productdescription" />
<attribute name="priceperunit" />
<attribute name="quantity" />
<attribute name="extendedamount" />
<attribute name="quotedetailid" />
<order attribute="productid" descending="false" />
<filter type="and">
<condition attribute="quoteid" operator="eq" uitype="quote" value="@QuoteId" />
</filter>
<link-entity name="product" alias="product" to="productid" from="productid" link-type="outer" visible="false">
<attribute name="price" />
</link-entity>
</entity>
</fetch>
我对组合查询的尝试(返回单个引用,但返回所有引用详细信息,无论父级如何):
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="quote" enableprefiltering="1" prefilterparametername="CRM_FilteredQuote" >
<attribute name="name" />
<attribute name="customerid" />
<attribute name="statecode" />
<attribute name="totalamount" />
<attribute name="discountpercentage" />
<attribute name="description" />
<attribute name="new_productsubgroupid" />
<attribute name="new_masterproductgroupid" />
<attribute name="quotenumber" />
<attribute name="ownerid" />
<attribute name="createdon" />
<attribute name="quoteid" />
<attribute name="effectiveto" />
<attribute name="effectivefrom" />
<order attribute="quotenumber" descending="true" />
<link-entity name="quotedetail" alias="quoteProduct" to="quoteid" from="quoteid" link-type="outer" enableprefiltering="1" prefilterparametername="CRM_FilteredQuote" >
<attribute name="productid" />
<attribute name="productdescription" />
<attribute name="priceperunit" />
<attribute name="quantity" />
<attribute name="extendedamount" />
<attribute name="quotedetailid" />
<order attribute="productid" descending="false" />
<link-entity name="product" alias="product" to="productid" from="productid" link-type="outer" visible="false" >
<attribute name="price" />
<attribute name="new_submittleurl" />
</link-entity>
</link-entity>
</entity>
</fetch>
【问题讨论】:
标签: reporting-services dynamics-365 fetchxml