Posts

Showing posts from November, 2020

How to loop through enum in dynamics ax 2012 using x++

    Method 1:     SysDictEnum                 sysDictEnum = new SysDictEnum(enumnum(InventTransType));     InventTransType             currentElement;              currentElement= sysDictEnum.firstValue();     do     {         info(strFmt("%1",currentElement));                  currentElement= sysDictEnum.nextValue(currentElement);              } while (currentElement != sysDictEnum.firstValue()); Method 2:     SysDictEnum                 sysDictEnum = new SysDictEnum(enumnum(InventTransType));     InventTransType             currentElement;     int                  ...

How to override lookupReference for reference group in Dynamics Ax 2012 using X++

  public Common lookupReference(FormReferenceControl _formReferenceControl) { Query query = new Query(); QueryBuildDataSource qbds; QueryBuildRange range; SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(HcmWorker), _formReferenceControl, true); sysTableLookup.addLookupField(fieldNum(HcmWorker, PersonnelNumber)); sysTableLookup.addLookupField(fieldNum(HcmWorker, Person)); sysTableLookup.parmQuery(query); qbds = query.addDataSource(tableNum(HcmWorker)); range = SysQuery::findOrCreateRange(qbds,fieldNum(HcmWorker,PersonnelNumber)); range.value(SysQuery::valueLikeAfter('10')); return sysTableLookup.performFormLookup(); }

How to convert between units in Dynamics AX 2012 using X++?

  Qty unitConv(ItemId            _itemId,                         UnitIDBase    _fromUnit,                         UnitIDbase     _toUnit,                         Qty                 _qty) {          Qty                                                    ret;        UnitOfMeasureConverter_Product  unitConverter   = UnitOfMeasureConverter_Product::construct();                   unitConverter.parmProduct(InventTable::find(_itemId).Product);     unitConverter....

Use the PreProcess report to handle the huge data and time out issue for SSRS reports in Dynamics AX 2012 R3

Extends the DP class from SrsReportDataProviderPreProcessTempDB : [     SRSReportParameterAttribute(classStr(ClassNameContract)) ] class ClassNameDP extends SrsReportDataProviderPreProcessTempDB {      TableNameTmp               tableNameTmpList; } Write the processReport method:   public void processReport() { ClassNameContract        contract                             = this.parmDataContract() as ClassNameContract; RecordInsertList           dataRecordInsertList = new                                                                          RecordInsertList(tabl...