Posts

display few dimensions, validations, mandatory on forms

 internal final class myCmpy_DimensionEntryController extends LedgerDefaultDimensionEntryController {     public boolean isAllMandatory;         public static myCmpy_DimensionEntryController construct()     {         myCmpy_DimensionEntryController controller = new myCmpy_DimensionEntryController();         controller.initialize();         return controller;     }     public boolean onValueSetLoad()     {         DimensionEnumeration oldDimensionsToAllowEdit = this.parmDimensionsToAllowEdit();         this.updateDimensionsToAllowEdit();         return this.parmDimensionsToAllowEdit() != oldDimensionsToAllowEdit;     }     public void updateDimensionsToAllowEdit()     {        /* InventParameters inventParameters = InventParameters::find();  ...

Custom API service, ODATA actions

// odata or data entity actions   public class CmpyWeighingEntity extends common {     /// <summary>     /// Updates the base price on purchase allocation lines for a given weight note,     /// joining BFSIndependentWeighingTable since CmpyMasterWeighingPurchAllocationTable     /// does not hold the weight note number directly.     /// </summary>     /// <param name = "_contract">The weighing details contract carrying company, weight note and base price.</param>     /// <returns>The response indicating the success or failure of the operation.</returns>          [SysODataActionAttribute("updatePurchaseLiquidationPrice", false),     SysODataCollectionAttribute("legalEntity", Types::String),     SysODataCollectionAttribute("weightTicketNo", Types::String),     SysODataCollectionAttribute("basePrice", Types::Real)]   ...

Useful predefined functoins

Current date and time  PurchTable.AccountingDate   = DateTimeUtil::date(DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone()));  with in qutoation string extraction example :   'Test'    int len = strLen(_formula);    int exprVal1 = strScan(_formula,"'",1,len);    int exprVal2 = strScan(_formula,"'",exprVal1+1,len);    int exprVal1Act = exprVal1+1;    if(exprVal1 && exprVal2)    {        Description typeId = subStr(_formula,exprVal1Act,exprVal2-(exprVal1Act));   } Num2Str convert number to string num2Str(_value,1,2,DecimalSeparator::Dot,ThousandSeparator::None); Formula conversion from string mathematics formula to result  ProdMathEvaluator mathEvaluator = ProdMathEvaluator::construct();  mathEvaluator.parmHandleException(true);  mathEvaluator.parmThrowOnError(false);  mathEvaluator.parmCal...

SSRS report (document reports) from the form based report - only Controller and RDP

Image
Controller   /// <summary> ///    The <c>InventABCController</c> class is the controller class for the <c>InventABC</c> SSRS report. /// </summary> class NXRSamplingResultReportController extends SrsReportRunController  {         public void prePromptModifyContract()     {         Query                   query;         QueryBuildDataSource    qbds;         EDF_SamplingTable       samplingTable;          Super();         if (this.parmArgs().record().TableId == tableNum (prodTable))         {             samplingTable   =   this.parmArgs().record() as prodTable;             query           =...

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...