none
"An item with the same key has already been added" when trying to add a tablix to a report

    Question

  • I have a report with a map component that when I try to add a tablix to it, generates this error.

    It previously had two tablix components on it that worked fine until I went to re-configure one of the tablix to not call a subreport and instead produce a databar on it's own (because the subreport ended up querying the database hundreds of times).

    BIDS would give an error when trying to pick the values for that databar, saying that the values had to be in the dataset that the tablix was using (though it clearly was since it was in the list of items to pick when configuring the databar). If I tried to configure the series group selecting one of the items from the list it would crash.

    I deleted those tablix entirely (after BIDS crashed 5 or 6 times) and now I get the error from the title, and cannot add a tablix to this report at all. I suspect something in the report definition is corrupt, but I don't see anything out of the ordinary in the rdl. Is the report salvagable? Does anyone happen to know what 'key' it's refering to?? The word key does not occur in the RDL anywhere.

    I would just re-create the report from scratch, but there are other aspects of it that have taken 4-5 days to develop that I can't just throw away.

    Thursday, August 12, 2010 5:30 PM

All replies

  • Hi,

    Apply this hotfix ( download it from  http://support.microsoft.com/kb/971049 ) to your reporting services to solve this issue.

    thanks,
    Jerry

    Friday, August 13, 2010 4:08 AM
    Moderator
  • Hi Jerry,

    Sorry, I neglected to mention that I'm running SQL 2008 R2 version of BIDS, and all the hotfixes referenced in that link appear to be for SQL 2008 SP1 - so they won't install.

    Friday, August 13, 2010 2:34 PM
  • I have run into this issue again with another report. This report has the map component as the main part of the report, and when I go to add a table to the report I get the same error. I've found that when I go to add other items to the report I get different errors. I get 'Object reference not set to instance of an object' when I try to add:

    sparkline
    chart

    I get 'An item with the same key has already been added' if I add:

    table
    list
    matrix

    Other items appear to work.

    • Marked as answer by Jerry NeeModerator Monday, August 23, 2010 1:00 AM
    • Unmarked as answer by Dev 4 Wednesday, August 25, 2010 4:07 PM
    Friday, August 13, 2010 8:32 PM
  • Further to my previous email... I can now re-create the problem every time. I set up a report from scratch. First add a map and hook it up to an SQL spatial data source. Then add a table and hook it up to a data source. Preview the report. Close the report, copy and paste the rdl file to a new rdl file within visual studio. Open the new file and try to add a table... the error will occur.

    As far as I can tell it only occurs when you use a SQL spatial data source.

    Monday, August 16, 2010 4:09 PM
  • And I believe I have finally found the source of this problem. There were two layers in the map based on two different datasets, but the field names in each of the data sets were the same. I wouldn't have thought that this would have been a problem since they're two different data sets, but maybe that changes when they're used in the same component (the map)?
    Monday, August 16, 2010 5:26 PM
  • FYI, this issue has popped up again and I definitely do not have any conflicting names between data sets this time. I have opened a support issue with MS.
    Tuesday, August 17, 2010 5:39 PM
  • Did you ever get a resolution? I have the same issue...fully up to date on SSRS 2008 SP2.
    Wednesday, December 01, 2010 2:51 AM
  • Try this

    http://arcanecode.com/2010/07/30/ssrs-quick-tip-an-item-with-the-same-key-has-already-been-added/

    It means that if you have two attributes with same name but from different tables, you should rename it,as SSRS will think the attributes are the same,

    let sey:

    Product.ownerid

    Item.ownerid

    you should alias it:

    Product.ownerid as OwneA

    Item.ownerid as OwnerB

     

    • Proposed as answer by Ursa Pangos Thursday, May 12, 2011 11:40 AM
    Thursday, May 12, 2011 11:40 AM
  • Microsoft said in early 2011 that they had included a fix in the one of the more recent cumulative update packs (6 or 7). I haven't tested it myself, as we spent more time than we ever wanted to on troubleshooting with MS and in the end dropped any project we had that was using their RS map component.

    I'd strongly advise against using it in anything more than a trivial report, my experience has been that it does not appear to be in any way mature or well supported.

    Monday, July 25, 2011 8:24 PM
  • Avatar of Ursa Pangos
    Ursa Pangos is correct. I had also faced the issue. Egs: I tried to fetch field with name AccountNum from two tables in a data set. Then the system threw this error. Later I gave a different label to one of the field and the issue was resolved.

    • Edited by Sreekanth KV Wednesday, October 23, 2013 1:28 PM Spelling mistake
    Wednesday, October 23, 2013 1:27 PM