Modify Element Value in a Map in Ax 2009

map themap;

dataareaid comp;

;

themap = new map(types::string, types::integer);

themap.insert(strfmt(comp),0);

I need to update the vlue during insertion of data of that particular comp value and increase the value of the key

thank u guys…

To update the value, simply insert a new with the same key and a new value. AX will automatically update the value, if the key already exists.

Thank u for the reply …

what if we want to increment the value of that particular key and to the condition that the key is random…can we do that ?

To increment a value, you simply read the current value, increment it and save it back.

I have no idea what you mean by a random key. If you want to update a specific value, you need to know its key.