Ax 2012 Arrays

An array is a collection of variables that are all of the same type. The elements of an array are accessed with simple integer indexes.

There are three kinds of arrays:

  • Dynamic
  • Fixed-length
  • Partly on disk

X++ only supports one-dimensional arrays. It is possible, however, to mimic the behavior of multiple array indices.

Example JOB:

static void ArrayTypes(Args _args)
Name DynamicArray[];
Name FixedArray[4];
//Name PartllyOnDiskArray[,8]; // if you use like this then it is Dynamic array of Name only 8 in memory
Name PartllyOnDiskArray[16,8];// if you use like this then it is Fixed length array of Name wit 16 elements and 8 in memory

int i,j;
 CustTable custTable;

while select AccountNum from custTable
where custTable.CustGroup==”30″
DynamicArray[i] = custTable.AccountNum;

FixedArray[i] = custTable.AccountNum;

PartllyOnDiskArray[i] = custTable.AccountNum;

setPrefix(“Array Types”);
for (j=1;j<=dimOf(FixedArray);j++)
info(strFmt(“Fixed Array – %1”,FixedArray[j]));
setPrefix(“Dynamic Array”);
for (j=1;j<=dimOf(DynamicArray);j++)
info(strFmt(“Dynamic Array – %1”,DynamicArray[j]));
setPrefix(“PartlyOnDisk Array Memory value”);
for (j=1;j<=dimOf(PartllyOnDiskArray);j++)
info(strFmt(“PartlyOnDisk Array – %1”,PartllyOnDiskArray[j]));
setPrefix(“PartlyOnDisk Array fully printed (Disk + Memory)”);
for (j=1;j<=16;j++)
info(strFmt(“PartlyOnDisk Array – %1”,PartllyOnDiskArray[j]));


How to Enable(Visible) or disable(Invisible) any report Section (header, Footer, Page Header, Page Footer etc.) by X++ for Ax AOT Reports in Ax 2009 or higher

As we know in AOT Reports there is a property called visible for the controls in the report. But for the report Section (header, Footer, Page Header, Page Footer etc) property does not exist. So we can do that from following code by writing this in fetch method as per your logic

ReportSection      reportSection ;  

        reportSection =‘PageFooter’);
        this.disableSection(PageFooter);// used for Disable Report section
        this.enableSection(reportSection);//used for Enable Report section

//this.enablePageFooter(); // this is used to enable page footer