Posts

Collection classes X++, Maps , list

  Class Description Data types Access List Values stored sequentially with ability to add values at the beginning or end of the list All values must be the same data type Use  ListIterator  or  ListEnumerator Set Values stored non-sequentially. Duplicates are not added to the set. All values must be the same data type Use  SetIterator  or  SetEnumerator Map Values stored by using a unique key. The key and the value need not be from the same data type. Use  MapIterator  or  MapEnumerator Struct Values stored by using a unique string as a key The key must be a string. The values can be of any type. Provide the string key to the value method Set Class examples   Set coffeeReceiptSet = new Set(Types::String);   if(coffeeReceiptSet.in(weightView.BFSIndependentWeighID))   {       continue;   }   else   {       coffeeReceiptSet.add(weightView.BFSIndependentWeighID);   } Map c...

Electronic reporting common used methods

Image
1.      ER with TempTable , We could write in table static method also  Internal final class NXRDebitNoteDeclarationERData {     [ERTableName(tableStr(NXRDebitNoteDeclarationERTableTmp))]     public static RecordLinkList getData(str _param)     {         NXRDebitNoteDeclarationERTableTmp erTable;         NXRCollateralOrgDistributeTable  distTable;         RecordLinkList recordLinkList = new RecordLinkList();                  int alignedType;         while select distTable             where distTable.PrepayIdParent == _param         {             erTable.PrepayId = distTable.PrepayId;             if(!alignedType)             {             ...

Exception handling, created transaction id UserConnection

 Cratedtransaction id , settalbeconnection parmuserconnections Independent transaction in AX Sometimes we need to write some data into a database independently on the currently running DB transaction. For example, we want to log some state occurred in the application, however any exception could cause a rollback of the whole transaction, including the log entry. It could look as follows: LogTable logTable; ; ttsbegin ; logTable. Message = "Something happens" ; logTable. insert ( ) ; //some following code in the same transaction throws an exception throw Exception :: Error ; ttscommit ; It can be resolved quite easily. We need to create a separate database connection and possibly our own transaction. The modification of the preceding code would look as follows: LogTable logTable; UserConnection connection = new UserConnection ( ) ; ; ttsbegin ; //use another connection logTable. setConnection ( connection ) ; //beginning of the independent transaction logTable. ttsbegi...

Data entity virtual fields and skip validate field, allow edit and allow edit on create

 public class BFSPrepaymentTableEntity extends common { // Postload & mapEntityToDataSource for virtual fields which helps you to push the values instead of recids      public void postLoad()     {         super();         //Populate virtual field once entity has been loaded from database         this.PrepayIdStr = this.PrepayId;         this.JournalNumStr = this.JournalNum;         this.IsCreatedStr = this.IsCreated;         EcoResCategory  ecoResCategory;         select firstOnly ecoResCategory             where ecoResCategory.RecId   == this.PrepayCategoryId;         this.EcoResCategoryCommodityCode = ecoResCategory.Code;     }     Public void mapEntityToDataSource(DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeCo...

dynamically add fileds , tables , values and update in form dialog lookup (dicttable, dictfield)

Check SysQueryForm form logic reference  [Form] public class NXR_TableFileldsUpdate extends FormRun {     int selectedTableId;     int selectedFieldId;     Str1260 fieldValueStr;     RefRecId    recIdValue;     int defaultTableId;     /// <summary>     ///     /// </summary>     public void init()     {         super();         TableName.text("EDF_ContractLine");         SqlDictionary sqlDict;         Select tabId From sqlDict                 Where sqlDict.name =="EDF_ContractLine"                 && sqlDict.fieldId==0;         selectedTableId = sqlDict.tabId;         defaultTableId = selectedTableId;         TableRecId.enabled(false); ...

create ledgerdimension from mainaccount in ax2012

 in AX 2012   only whereas d365fo ,we have ledgerdimensionfacade is there //SIG_22435_BudgetsInAXByCostCentre - 19- Sep -2023 - Hreddy public  LedgerDimensionDefaultAccount getDefaultAccountFromMainAccountRecId(MainAccountRecId _mainAccountRecId) {     recId                   dimAttributeId;     DimensionAttributeValue dimAttributeValue;     int                     segmentIndex;     str                     newValue;     /*DimensionAttributeValue mainAcctDimAttrValue;     DimensionStorage        dimStorage;     MainAccount             mainAccount;     container               result;     DimAttributeMainAccount attrMainAcc;  ...

Generate CAR report d365fo

Image
  Commands  Cd C:\ K: C:\cd K:\AosService\PackagesLocalDirectory\bin xppbp.exe -metadata=K:\AosService\PackagesLocalDirectory -all -model=EDF -xmlLog=C:\BPCheckLogcd.xml -module=EDF -car=c:\temp\CAReport.xlsx