Adding/Recovering attributes from graphic

3293
3
Jump to solution
04-24-2014 04:55 AM
OlivierNols
New Contributor
Hi,

I'm currently developing an application which, at some point, add Graphic objects to a GraphicsLayer. These Graphic objects have a map of attributes. These attributes are custom object type that I have created.
My problem is : when I recover a Graphic object from the GraphicsLayer and try to recover an attribute from the Graphic object that I recovered, the attribute is a String (the string return by the method toString() overrode by my custom object) not my object anymore.
Is this the normal behaviour or have I made a mistake somewhere ?

Thanks in advance,
Olivier

P.S : I'm working with 10.2 version of the SDK
0 Kudos
1 Solution

Accepted Solutions
JohnWass
New Contributor III
Unfortunately it appears to be the expected behavior.

Finally, although you can add any object to the attributes the underlying core code will only support the types allowed by ESRI servers e.g. numbers, strings, dates etc. This means that your object will be turned into a string by calling toString on it since it is not one of the recognised types.


http://forums.arcgis.com/threads/97550-Can-I-add-Attribute-with-Mutable-object-to-Immutable-Graphic?...

View solution in original post

0 Kudos
3 Replies
JohnWass
New Contributor III
Unfortunately it appears to be the expected behavior.

Finally, although you can add any object to the attributes the underlying core code will only support the types allowed by ESRI servers e.g. numbers, strings, dates etc. This means that your object will be turned into a string by calling toString on it since it is not one of the recognised types.


http://forums.arcgis.com/threads/97550-Can-I-add-Attribute-with-Mutable-object-to-Immutable-Graphic?...
0 Kudos
OlivierNols
New Contributor
Thanks for the precision altough I would have prefered it to be a mistake from myself...
And as said in the post that you linked, it would be nice to be mentionned in the API Reference
0 Kudos
JeremieJoalland1
Occasional Contributor II
I asked already the same question in this forum, and answer was clear :

Finally, although you can add any object to the attributes the underlying core code will only support the types allowed by ESRI servers e.g. numbers, strings, dates etc. This means that your object will be turned into a string by calling toString on it since it is not one of the recognised types.

original post here !
0 Kudos