Remove duplicates items in drop down SSRS 2008

Answered Remove duplicates items in drop down SSRS 2008

  • Friday, September 14, 2012 1:55 PM
     
     

    Hi everybody,

    I need remove duplicate item in drop down choice. 

    I can remove in rendering although of code ?



    Robson Hasselhoff - Follow me @Robk9e

All Replies

  • Friday, September 14, 2012 2:28 PM
     
     

    Hello,

    Split the one dataset into 2 separates; one for "site" and one for "data", otherwise you always will have "duplicates".


    Olaf Helper
    Blog Xing

  • Friday, September 14, 2012 2:50 PM
     
     

    Hello Olaf, 

    Already own separate dataset for each parameter, and is connected to the other.
    example:

    Dataset: List_site
    SELECT DISTINCT FROM wakeonlan.tbl_total site

    ID | SITE

    01 | Default-First-Site-Name

    02 | Site-Secundario

    Filters: None

    Dataset: List_date

    select distinct convert(VARCHAR(10),data,(105)) as data,site from wakeonlan.tbl_total

    13-09-2012 Default-First-Site-Name
    13-09-2012 Site-Secundario
    14-09-2012 Site-Secundario

    Filters: site IN @site

    Dataset: show_data

    SELECT  id, m_ligadas, m_desligadas, m_lig_pos, m_des_pos, site, leva, CONVERT(VARCHAR(10), data, 105) AS data FROM wakeonlan.tbl_total



    Filters: 

    site IN @site

    data IN @data

    Still out in duplicate as parameters :s


    Robson Hasselhoff - Follow me @Robk9e



  • Friday, September 14, 2012 5:21 PM
     
     Answered

    Hi Robson,

    The problem is where you're applying the filter.  You're getting a distinct list of dates for each site (so the same date may appear more than once), then filtering out the ones for the selected site(s):

    Remove the filter from the dataset and use this instead:

    select distinct convert(VARCHAR(10),data,(105)) as data from wakeonlan.tbl_total where site in (@site)

    Regards
    James


    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.


  • Friday, September 14, 2012 6:44 PM
     
     

    Hi There,

    The problem is with your query for List_date dataset. In this query, you are doing a distinct on two columns "convert(VARCHAR(10),data,(105)) as data" and "site" and as we can see from the above results which you posted, they are indeed distinct (combination is distinct). However, if you look at the first column alone (Data column), it has "13-09-2012" repeating twice but each one with a different "Site" value. Modify your query like this:

    SELECT DISTINCT convert(VARCHAR(10),data,(105)) as data FROM wakeonlan.tbl_total

    Hope that helps!


    Best Regards,
    Datta
    ----------------------------------------------------------------------------------------------------
    Dattatrey Sindol
    My BlogDatta's Ramblings on Business Intelligence 'N' Life
    The information provided here is "AS IS" with no warranties, and confers no rights.
    Please mark the post as answered if it solves your problem.

  • Saturday, September 15, 2012 6:02 AM
     
     

    Take a look at this...

    http://blogs.msdn.com/b/sqlforum/archive/2011/04/28/walkthrough-how-to-get-distinct-values-of-a-column-of-a-sharepoint-list-using-sql-server-reporting-services.aspx

    It's an easy, clean method that keeps you from having to add a 2nd datasouce.

    HTH,

    Jason


    Jason Long

  • Saturday, September 15, 2012 3:36 PM
     
     
    THanks J Still, that's it !!!

    Robson Hasselhoff - Follow me @Robk9e

  • Saturday, September 15, 2012 3:37 PM
     
     

    Hi Dattatrey 

    IF I used so would be inconsistent means, but thanks!


    Robson Hasselhoff - Follow me @Robk9e

  • Saturday, September 15, 2012 3:38 PM
     
     
    Hi Jason the solution of J Still solved my problem, but will test this method! thanks

    Robson Hasselhoff - Follow me @Robk9e