web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Prefiltering not working - Sql query

(0) ShareShare
ReportReport
Posted on by 510

I have seen many articles that show how to use PreFiltering in SSRS with Sql query. They said to use CRMAF_[FilteredView] but didn't work for me and ever brings me the first Quote, not the current Quote.

I removed the sql query with CRMAF_ because it was not working well.

I have 3 DataSets

The main DataSet is this one:

SELECT
[produto].productid AS [productid]
,[produto].productnumber AS [productnumber]
,[produto].name AS [productname]
,[produto].description AS [description]
,[produto].smart_especificacaotecnica AS [productspecification]
,[produto].smart_buidname AS [BU]
,[produto].smart_especialidadesname AS [especialidade]
,[produto].ptr_representadaidname AS [representada]
,[produto].smart_gruponame AS [grupo]
,[produto].smart_subgruponame AS [subgrupo]
,[produto].smart_registroanvisa AS [registroanvisa]
,[produto].smart_lp_fabricantename AS [fabricante]
,[produto].ptr_ncm AS [ncm]

,[linha].priceperunit as [price]
,[linha].smart_valor_ipi as [ipi]
,[linha].smart_percentualipi as [percentualipi]
,[linha].smart_valor_unitario_ipi as [ipiunitario]
,[linha].tax as [tax]

,cast([linha].quantity as decimal) as [quantity]
,[produto].iskit as [explodir]
FROM
FilteredProduct AS [produto]
INNER JOIN
FilteredQuoteDetail AS [linha]
ON [produto].productid = [linha].productid

WHERE
[linha].quoteid = @quoteid

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    First, not sure which CRM version you are using. I test your query in CRM 2013 and it is not work the first time with CRMAF. I run the report from a product and I get all products as the result.

    Then I change you alias table name. The important part is the table name should be same as CRM table except CRMAF part. I run the new report and it only return the selected product in the report.

    Please check and let me know if this fix works for you.

    my query is something like below:

    SELECT

    CRMAF_Product.productid AS [productid]

    ,CRMAF_Product.productnumber AS [productnumber]

    ,CRMAF_Product.name AS [productname]

    ,CRMAF_Product.description AS [description]

    ,CRMAF_QuoteDetail.priceperunit as [price]

    ,CRMAF_QuoteDetail.tax as [tax]

    ,cast(CRMAF_QuoteDetail.quantity as decimal) as [quantity]

    ,CRMAF_Product.iskit as [explodir]

    FROM

    FilteredProduct AS CRMAF_Product

    INNER JOIN

    FilteredQuoteDetail AS CRMAF_QuoteDetail

    ON CRMAF_Product.productid = CRMAF_QuoteDetail.productid

  • Verified answer
    HenriquePalomo Profile Picture
    510 on at

    I figured out the problem by creating another project and data set. Now i can see the prefiltering working on DataSet query in visual studio and on CRM.

    Thx for help.

  • HenriquePalomo Profile Picture
    510 on at

    I forgot to say that i used the same query, i just created the dataset / project.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans