how to add different datatype values to a map class.


I want to add different datatype values to a map class which will allow me to move the data put in it to any application object while execution.

I have tried adding values to container and then adding container to map. But, there should some easy way to do it.

map = new Map(Types::String, Types::Container);

Is there any other way?

Thanks in advance.

What is the requirement? If you want to iterate any application objects why don’t you use ‘Treenode’ ,‘Enumerator’.

The Map class allows you to associate one value (the key) with another value. Both the key and value can be any valid X++ type, including objects. The way in which maps are implemented means that access to the values is very fast.

Refer Map class

Hi Chiranjeevi,

I am not sure that what you exactly want.

You can try anytype types for this purpose in map class.

Map TestMap = new Map(Types::Int64, Types::AnyType);
TestMap.insert(1, ‘Test’);
TestMap.insert(2, 1);
TestMap.insert(3, 3.5);
info(strFmt(’%1’, any2real(TestMap.lookup(3))));

You can store different datatype values in container also. Please refer this URL!/2012/09/simple-ax-container-example.html



Hi Vishal,

I am trying to transfer a group of data from one object to other(for eg: a form to report) so that I can filter the data there with the values entered in the form.

Even I know adding values to a container and converting the container to containerClass object and then sending it the report.

I am trying to make it even more simple by directly sending the values to the report irrespective of using map class or a container or some other class.