MapThat – An Item With the Same Key Has Been Added

Marketing
Marketing
  • Updated

By David Crowther

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_1.JPG

Question:

What is causing the MapThat error – An item with the same key has already been added?

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_2.JPG

Answer:

This issue is caused because at least one Information Bubble has been incorrectly configured.

The root of the problem is that for the same Information Bubble record there are two Attribute values where the source field name is referenced twice in the Attr Column. For example below, we have a Bubble to show the Ward Names for the Wards in Liverpool.

However, by mistake when we created the attribute record to show the Councilor Name, instead of choosing the ‘Councilor’ field from the source table we have chosen the Ward field again. As we can see the Ward field is already being used in line item 1 to show the Ward Name, so now it is being referenced twice.

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_3.JPG

If this configuration was saved, the error would occur when you log in to MapThat.

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_4.JPG

To resolve the issue ensure that each Attribute record for all bubbles use unique field names from their source table. In this case we will set the Attr Column value correctly – now using the Councillor field.

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_5.JPG

With this fix implemented MapThat will now open as expected!

In later versions of the MapThat Admin Forms, if a Database Constraint/Index has correctly been implemented e.g. an index to apply a unique constraint between the Bubble ID and the Attr_Column -

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_6.JPG

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_7.JPG

,…. then there will be a control/check within the Admin Forms that will stop you from saving these incorrect changes. Below when we try to make the mistake of referencing the same Attr Column twice the Admin Forms will recognise a duplicate value trying to be saved to the MapThat database and the save will not be committed.

MapThat___An_Item_With_the_Same_Key_Has_Been_Added_-_8.JPG

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.