Posts

Showing posts with the label create

Create() method in the AX foundation classes.

Image
When it comes to creating and using Maps, Lists or Arrays, we normally initialize them using the new() method. Then we use the respective methods on these to insert the data. All these classes have a static method create() which can both initialize and insert values into these at the same time. Even though, the method takes a container parameter in all the three cases, the content of the containers are very different from each other. Let us look at all the three in detail. Download the XPO for the source code from here . Code for Array class. static void ArrayInit(Args _args) { Array ageArray, nameArray; container conValues; counter i; ; conValues = [1, 1, 3, 10, 20, 30, 40]; ageArray = Array::create(conValues); print "Printing age array (consecutive values) ..."; for(i=1; i { print ageArray.value(i); } conValues = [2, 1, 3, 2, 20, 4, 40]; ageArray = Array::create(conValues); print...