By David Crowther
What is causing the MapThat error – An item with the same key has already been added?
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.
If this configuration was saved, the error would occur when you log in to MapThat.
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.
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 -
,…. 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.