我在 Visual Studio 2008 中制作了一个基于 SQL 的报告并将其上传到 CRM。我指出您只能在“相关记录类型的表单”上运行它。我认为这会为您所在的当前记录生成 1 份报告。
事实并非如此。它为特定实体(订单)的每条记录生成一个报告,报告中每页 1 条记录。
我知道我必须使用数据预过滤(自动或特定?),但网上没有很好的例子,stackoverflow 上什至有一个线程,但我就是想不通。
链接到线程:CRM 2011 中的 CRMAF 过滤
SELECT FilteredSalesOrder.customerid AS x1, FilteredAccount.accountid AS x2, FilteredSalesOrderDetail.salesorderid AS x3, FilteredSystemUser.systemuserid AS x4,
FilteredProduct.productid AS x5, FilteredAccount.address1_city, FilteredAccount.address1_line1, FilteredAccount.address1_postalcode, FilteredAccount.name AS AccountName,
FilteredSalesOrder.ordernumber, FilteredSalesOrderDetail.quantity, FilteredSystemUser.fullname, FilteredProduct.fmcg_erpreference, FilteredProduct.name AS ProductName
FROM FilteredSalesOrder INNER JOIN FilteredAccount
ON FilteredSalesOrder.customerid = FilteredAccount.accountid INNER JOIN FilteredSalesOrderDetail
ON FilteredSalesOrderDetail.salesorderid = FilteredSalesOrder.salesorderid INNER JOIN FilteredProduct
ON FilteredProduct.productid = FilteredSalesOrderDetail.productid INNER JOIN FilteredSystemUser
ON FilteredSystemUser.systemuserid = FilteredSalesOrder.ownerid
仅预过滤数据以使用当前订单:
- 仅将CRMAF_ 与SalesOrder 表一起使用,就足够了吗?
FROM FilteredSalesOrder AS CRMAF_FilteredSalesOrder INNER JOIN FilteredAccount
- 对所有表使用 CRMAF_ ?
编辑:
这是我在 FilteredSalesOrder 上使用 CRMAF_ 的新的整个 SQL。但可惜它不起作用。它仍然只给我机会对所有记录运行它,从而生成所有存在的销售订单(幸运的是没有那么多)。
SELECT CRMAF_FilteredSalesOrder.customerid AS x1, CustomerAccount.accountid AS x2,
FilteredSalesOrderDetail.salesorderid AS x3, FilteredSystemUser.systemuserid AS x4,
FilteredProduct.productid AS x5,CRMAF_FilteredSalesOrder.fmcg_supplierid as x6,
CustomerAccount.address1_city as customerCity, CustomerAccount.address1_line1 as
customerStreet1, CustomerAccount.address1_postalcode as customerPostalCode,
CustomerAccount.name AS CustomerAccountName, CRMAF_FilteredSalesOrder.ordernumber,
FilteredSalesOrderDetail.quantity, FilteredSystemUser.fullname,
FilteredProduct.fmcg_erpreference, FilteredProduct.name AS ProductName,
SupplierAccount.name as supplierAccountName, SupplierAccount.address1_city AS
supplierCity,SupplierAccount.address1_line1 as supplierStreet1,
SupplierAccount.address1_postalcode as supplierPostalCode,
CRMAF_FilteredSalesOrder.requestdeliveryby, CRMAF_FilteredSalesOrder.createdon
FROM FilteredSalesOrder AS CRMAF_FilteredSalesOrder INNER JOIN FilteredAccount AS CustomerAccount
ON CRMAF_FilteredSalesOrder.customerid = CustomerAccount.accountid INNER JOIN FilteredSalesOrderDetail
ON FilteredSalesOrderDetail.salesorderid = CRMAF_FilteredSalesOrder.salesorderid INNER JOIN FilteredProduct
ON FilteredProduct.productid = FilteredSalesOrderDetail.productid INNER JOIN FilteredSystemUser
ON FilteredSystemUser.systemuserid = CRMAF_FilteredSalesOrder.ownerid INNER JOIN FilteredAccount AS SupplierAccount
ON CRMAF_FilteredSalesOrder.fmcg_supplierid = SupplierAccount.accountid
解决方案:删除报告并重新部署它。