"An item with the same key has already been added."

Posted by: jcoxprog on 3 August 2017, 3:54 pm EST

  • Posted 3 August 2017, 3:54 pm EST

    I get the following exception when doing the following code, which is virtually identical to supplied examples

    Dictionary fields = new Dictionary();

    foreach ( DataColumn col in m_SalesStats.ResultSet.Columns )


    fields.Add(col.ColumnName, col.DataType);


    SchemaBuilder sb = SchemaBuilder.AutoGenerate("MySchema", fields); <<<<< Exception thrown here

    DataDynamics.Analysis.Schema.AttributesDimBuilder attributesDimension = (DataDynamics.Analysis.Schema.AttributesDimBuilder)sb.Dimensions["Attributes"];

    I have verified there are no duplicate fields in the underlying SQL. I have steped thorugh the loop numerous times as well and all fields are unique.

    Also I am using a demo version of the Analysis tool for evaluation purposes.

    Another question is do I require more dimensionms than just the attributes dimension, or can I just populate that dimension then let the use select what fields they want to put in other dimensions.


  • Replied 3 August 2017, 3:54 pm EST


    One of the fields in the SQL was aliased to the word Date, which is not the best name for a field. The list of fields was unique, but it seems like a field name of Date caused the conflict since this now works after changing that field name.

    Is there a set of field names that are considered reserved words when setting up a schema, because in the attributes box I see the words Date, Year, Month, Quater, Week, ... under the newly renamed date field.

  • Replied 3 August 2017, 3:54 pm EST

    <h2>jcoxprog,</h2>Thank you for detailed description. We've entered a Case 137399 ("An item with the same key has already been added." error during schema generation.) to address this issue.

    Thank you,
    Andrey T.

  • Replied 3 August 2017, 3:54 pm EST


    Case 137399 (Fixed an issue where a query containing a field named "Date" would throw an exception when attempting to auto-generate a schema for the query) has been fixed in the latest version of Data Dynamics Analysis (1.0.912.0).

    You may download this build from here:
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels