Bojensen Blogs

Tag: X++

Coding against Dimensions

The usual method of programming against a specific dimension in Ax is as follows: salesTable.Dimension[SysDimension::Center + 1] = ‘The cost centre’; However, this code is not technically correct. It relies on the enum value of the dimension matching the array dimension (plus 1), which is not guaranteed. If a developer follows Microsoft’s best practice guide…

Using InventDim::newDimId in Axapta Programming

InventDim myInventDim; ; myInventDim.clear(); //You have to put in existing dimensions and values for them below myInventDim.InventLocationId = "Main"; myInventDim.InventColorId = "Blue"; //So far the RecId of the myInventDim record buffer is 0 myInventDim = InventDim::findOrCreate(myInventDim); //Now the RecId is not 0, and the InventDimId is a new or an existing InventDimId info(myInventDim.InventDimId); Using InventDim::newDimId…