Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Contributor
Posts: 45
Registered: ‎11-12-2015
Accepted Solution

FormMap Error: An item with the same key has already been added.

Hi all,

 

I have a FormMap in my Form that is also used in FormReport. This map is displayed correctly in pdf report, but it is not displayed at all in the form - it says: "An item with the same key has already been added."

 

FormMap definition:

<FormMap name="Map" label="Map" layers="522,981" activelayer="981" fitelements="{FORM.ID1}" drawingmode="selected" />

 

Workflow log:

28.11.2016 09:42:01 ERROR - Controller Form has raised an exception in Action DownloadMap.
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value)
at System.Web.Mvc.JsonValueProviderFactory.AddToBackingStore(EntryLimitedDictionary backingStore, String prefix, Object value)
at System.Web.Mvc.JsonValueProviderFactory.GetValueProvider(ControllerContext controllerContext)
at System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider(ControllerContext controllerContext)
at System.Web.Mvc.ControllerBase.get_ValueProvider()
at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor)
at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState)

 

Any suggestions, where the problem might be? (I am using GMSC2015 SP1.)

 

Thanks,

 

Tereza

Staff
Posts: 839
Registered: ‎10-18-2015

Re: FormMap Error: An item with the same key has already been added.

Hi Tereza,

 

could you please set it to persisted="false"?

 

Thanks,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 45
Registered: ‎11-12-2015

Re: FormMap Error: An item with the same key has already been added.

Hi Stefano,

 

it made no change. Still the same error

 

Tereza

Staff
Posts: 839
Registered: ‎10-18-2015

Re: FormMap Error: An item with the same key has already been added.

Could you please check by using a static value for fitelements?

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 45
Registered: ‎11-12-2015

Re: FormMap Error: An item with the same key has already been added.

Hi,

 

I tried this configuration: 

 

<FormMap name="Map" label="Mapa" persisted="false" layers="522,981" activelayer="981" fitelements="705" drawingmode="selected" />

and also this one (with range instead of fit element and active layer):

 

<FormMap name="Map" layers="522,981" persisted="false" range="-660345,-1098148,-630000,-1075000"/>

 

and I am getting the same error (but both cases are working in report). 

 

Tereza

Staff
Posts: 839
Registered: ‎10-18-2015

Re: FormMap Error: An item with the same key has already been added.

it might be related to feature configuration. Is the primary key set for the feature in the admin? What is the column type? Could you please try to use a different feature to be shown on the map?

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 45
Registered: ‎11-12-2015

Re: FormMap Error: An item with the same key has already been added.

Hi Stefano,

 

I finally found where the problem is. I have this formfield in my workflow with FormMap:

 

<FormField name="HEIGHT" label="Výška"  visible="form" editable="true" type="textfield" datatype="number"/>			

The attribute HEIGHT probably colides somehow with FormMap. Sorry, I didn't post my formsettings file, so you couldn't see this problem.

 

The FormMap is displaying fine, when I remove this FormField. But I actually need it there for user to be able to edit this attribute in table. I know I can rename it, set it to persisted="false" and then use some workflow trigger with update to edit this attribute, but it is a bit complicated.

 

Is there any easier workaround so I can use standard "save" action on HEIGHT attribute and let FormMap working?

 

Thanks,

 

Tereza

Staff
Posts: 839
Registered: ‎10-18-2015

Re: FormMap Error: An item with the same key has already been added.

Hi Tereza,

 

I would say what you suggested is the most simple solution, just a workflowtrigger, method="after", together with save action to save the non persisted formfield.

 

ciao,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Contributor
Posts: 45
Registered: ‎11-12-2015

Re: FormMap Error: An item with the same key has already been added.

Hi,

 

I filled SR 1-1898020831 for this

 

Tereza

Highlighted
Staff
Posts: 256
Registered: ‎02-04-2016

Re: FormMap Error: An item with the same key has already been added.

Hi Tereza,

 

I have filed CR-D 1-VSQVKD for this issue.

 

Regards,

 

Frank

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.