How to Filter fields in ssrs custom reports in mscrm 2011

Răspuns How to Filter fields in ssrs custom reports in mscrm 2011

  • 29 februarie 2012 12:57
     
     

     Hi All,

    I have an requirement to create a custom ssrs reports in ms crm 2011 on premise.

    The scenario is  I have two tables one is Customer and  another one  Project.So here my report is should be like this -- I am  passing a parameter called Customer Name   and in second parameter called 'Projects'  should list out all project related to  the first parameter 'customer'.

    Example..


     How to write the query for this... please help me...











    Krishn Prasad Shetty

Toate mesajele

  • 29 februarie 2012 13:32
     
     
  • 1 martie 2012 01:41
     
     Răspuns

    For your reference,

    1. Create a DataSet called DS_Customer as following.

        Select new_CustomerName, new_CustomerId from filterednew_customer

    2. Create a Parameter called CustomerId As following.
        Available Values - Get values from a query.
        Dataset: Ds_Customer
        Value field: new_CustomerId
        Label field: new_CustomerName

    3. Create a DataSet called DS_Project as following.

       Select new_ProjectName, new_ProjectId from filterednew_project AS P WHERE
       P.new_CustomerId = @CustomerId

    4. Create a second parameter called ProjectId As following.
        Available Values - Get values from a query.
        Dataset: Ds_Project
        Value field: new_ProjectId
        Label field: new_ProjectName

     5. Make sure paramerter CustomerId must be on top.


    Regards, Kyaw Kyaw Tun

    • Propus ca răspuns de Kelly Hoang 1 martie 2012 07:43
    • Marcat ca răspuns de Shetty KP 2 martie 2012 07:01
    •  
  • 1 martie 2012 03:37
     
     
    Thanks for your reply..

    Krishn Prasad Shetty

  • 1 martie 2012 03:39
     
     
    Is it working for you?

    Regards, Kyaw Kyaw Tun

  • 1 martie 2012 06:48
     
     

    Hi Faisal ,

    This is my reports screen shot.

    Here I Taken two parameters Customer name and Project Name. I need to filter such a way that ,when I select  Customer Name from 'India Info Line'  then in Project name field should show the project Names  for the customer 'India Info Line'

     After That I will Select the Project Name and view the report. But Here  now it shows all the projects that comes in all customers. How to filter it based on first parameter(Customer Name) to display  project Names only for  selected customer in second parameter.


    Krishn Prasad Shetty

  • 1 martie 2012 10:29
     
     

    Hi.. Tried same thing how you specified but i am getting only "new_projecttopic" from query.

    This is the step  what i did.... tell me if I did any thing wrong...


    1)Created a data set (DataSet2) and query is  ,

    select  distinct Filterednew_projectstatus.new_potentialcustomerid ,
             Filterednew_projectstatus.new_potentialcustomeridname
              from Filterednew_projectstatus

    IT Displays customer name and customer-id -- fine.


    2)Created a Parameter (ReportParameter1)  as following ,

        Data set: DataSet1
        Value field: new_potentailcustomerid
        Label field:new_potentailcustomeridname


    3) Created second data set (DataSet3) with query is  ,

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomeridname IN ('@ReportParameter1')

    Here I am getting the  output is  'new_projecttopic'  it wont gives project name .Why?

    4)Created a second  Parameter (ReportParameter2)  as following ,

        Data set: DataSet2
        Value field: new_projecttopic
        Label field:new_projecttopic.

    Doing all these and while checking preview i am getting like this.... ?

     

      




    Krishn Prasad Shetty

  • 1 martie 2012 22:14
     
     

    3) Created second data set (DataSet3) with query is  ,

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomeridname IN ('@ReportParameter1')

    should be

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomerid IN (@ReportParameter1)


    Regards, Kyaw Kyaw Tun

  • 2 martie 2012 03:43
     
     

    Hi.. Thanks for your reply...


    I tried this query

      select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomerid IN (@ReportParameter1)

    but  i am getting  error like this ,

    "Conversion failed when converting from a character string to uniqueidentifier"


    Krishn Prasad Shetty

  • 2 martie 2012 04:25
     
     

    Change the ReportParameter1 Value field as follow.

    Created a Parameter (ReportParameter1)  as following ,

        Value field: new_potentailcustomeridname
        Label field:new_potentailcustomeridname

    Created second data set (DataSet3) with query is  ,

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomeridname IN (@ReportParameter1)

    I hope this will solve your problem.


    Regards, Kyaw Kyaw Tun



  • 2 martie 2012 05:06
     
     

       Yes  I tried this one... see this is my Parameter1 and the query of dataset3 is

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomeridname IN ('@ReportParameter1')

     If  I execute this  I am getting this ,


    Krishn Prasad Shetty

  • 2 martie 2012 05:33
     
     

     select  new_projecttopic from Filterednew_projectstatus
             where  new_potentialcustomeridname IN ('@ReportParameter1')

    without single quote

             where  new_potentialcustomeridname IN (@ReportParameter1)


    Regards, Kyaw Kyaw Tun

  • 2 martie 2012 06:28
     
     

    Hi ... Kyaw Kyaw Tun

    I tried all these... it gives error ... that is -- (Msg 137, Level 15, State 2, Line 3
    Must declare the scalar variable "@ReportParameter1".)


    Krishn Prasad Shetty

  • 2 martie 2012 07:03
     
     

      Hi ,

    Thanks for your reply , i got the solution ... Finally report is working fine...

    Thanks a lot  Kyaw Kyaw Tun


    Krishn Prasad Shetty

  • 4 martie 2012 22:13
     
     
    Cheers!

    Regards, Kyaw Kyaw Tun