18 May 2015

Creating Ledger Dimension Using a segmented entry control + ax 2012

  • Segmented entry control can simplify the task of entering complex main account and dimension combinations. 
  • The control consists of a dynamic number of elements named segments. The number of segments may vary, depending on the setup, and their lookup values may be dependent on the values specified in other segments in the same control. 
  • The segmented entry control always uses the controller class, which handles the entry and display in the control.
Example 
  • LedgerParameters table and create a new field with the following properties (click on Yes to automatically add a foreign key relation once asked):


  • Find the table's relation named DimensionAttributeValueCombination, and change its property as follows:


  • In  LedgerParameters form, and add the following code to its classdeclaration():
            LedgerDimensionAccountController ledgerDimensionAccountController;


  • following code to the bottom of the form's init() method.




  • Locate the General_LedgerDimension segmented entry control located in Tab | LedgerTab | LedgerTabBody | LedgerTabFastTab | GeneralTabPage | General, and override methods.




public void loadAutoCompleteData(LoadAutoCompleteDataEventArgs _e)
{
super(_e);
ledgerDimensionAccountController.loadAutoCompleteData(_e);
}

public void loadSegments()
{
super();
ledgerDimensionAccountController.parmControl(this);
ledgerDimensionAccountController.loadSegments();
}

public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
super(_e);
ledgerDimensionAccountController.segmentValueChanged(_e);
}






On the same form, in its LedgerParameters data source, locate the
LedgerDimension field, and override three of its methods with the following code:


public Common resolveReference(
FormReferenceControl _formReferenceControl)
{
return ledgerDimensionAccountController.resolveReference();
}

public void jumpRef()
{
super();
ledgerDimensionAccountController.jumpRef();
}

public boolean validate()
{
boolean ret;
ret = super();
ret = ledgerDimensionAccountController.validate() && ret;
return ret;
}






Output




No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...