The Dynamics AX2012 Segmented Entry Control for Developers - Introduction

The Segmented Entry Control

You'll use this page to gain understanding about fundamental elements and use of the Segmented Entry Control. Look within Dynamics AX2012 for specific implementation examples. This brief overview introduces you to fundamental aspects and the things to look for in the examples in order to author your own instance of the Segmented Entry Control.

 

 

 

1) Open/Close control for explicitly opening or closing the Contextual Fly-out

2) The Contextual Fly-out, with descriptions of each of the segments.

3) Lookup control for dropping a lookup window that contains segment values.

4) The lookup window aligns itself with the current segment for readability.

5) The lookup window contains an expand/collapse chevron that exposes optional functionality.

6) The lookup window will filter to show only valid segment values

7) Instance level control options are enabled or disabled here.

 

 

LedgerDimensionAccountController

The Segmented Entry Control is simply a means of interacting with the user. It presents data and allows the user to enter data. The actual behavior of the control is provided by X++ business logic. In AX6, the X++ business logic is implemented with a powerful LedgerDimensionAccountController class. This class responds to events raised by the Segmented Entry Control for populating, filtering and persisting segments based on other segment context.

 

Surrogate Key Replacement

A multi-segmented account number is a heavyweight construct to use as a key for representing a transaction. Therefore, an under-the-covers key or a "surrogate" key is used to represent the account number. AX6 introduce the concept of a surrogate key replacement. While a surrogate key replacement is available as a stand-alone construct, it is baked into the Segmented Entry Control.

 

Steps for implementing a surrogate key replacement in AX6: (these are actual steps for working with AX6 Financials)

 

Create a relation to the DimensionAttributeValueCombination table.

Go to the relations node for the target table and create a new relation.
Change the name of the relation to be LedgerDimension and the table for the relation to be DimensionAttributeValueCombination

Right click on the LedgerDimension relation and choose New foreign key. This will create a new field in the DimensionAttributeValueCombination table. Name this field LedgerDimension. The EDT for this field should be set to LedgerDimensionAccount.

 

Steps for managing a Segmented Entry Control with the LedgerDimensionAccountController Class

 1. Verify that the table that will hold the Foreign Key to the DimensionAttributeValueCombination table is a datasource on the form.

2. Drag the LedgerDimension field from the datasource to the desired location on form design. This should add a SegmentedEntry control at this location on the form with appropriate DataSource and ReferenceField property values. Alternatively this can be done by adding a SegmentedEntry control to the design and manually setting the DataSource and ReferenceField properties.

3. Override the following methods on the form.

public class FormRun extends ObjectRun

{    LedgerDimensionAccountController ledgerDimensionAccountController;

}

 public void init()

{

    super();

        ledgerDimensionAccountController = LedgerDimensionAccountController::construct(BackingDataSource_ds,fieldstr(BackingTable, LedgerDimension));

}

Code Example: Methods overridden on the form

 

 

 

4. Override the following methods on the SegmentedEntry control instance in the design.

public void jumpRef()

{ ledgerDimensionAccountController.jumpRef();

}

 

public boolean validate()

    boolean isValid;

 

    isValid = super();

    isValid = ledgerDimensionAccountController.validate() && isValid;

     return isValid;

}

 

public void segmentValueChanged(SegmentValueChangedEventArgs _e)

{

     super(_e);

             ledgerDimensionAccountController.segmentValueChanged(_e);

}

 

public void loadSegments()

{   

    super();

    ledgerDimensionAccountController.parmControl(this);   

 

    // The value of this parameter varies depending on the type of form.

     ledgerDimensionAccountController.parmDimensionAccountStorageUsage(...);

        ledgerDimensionAccountController.loadSegments();

}

 

public void loadAutoCompleteData(LoadAutoCompleteDataEventArgs _e)

{

      super(_e);

               ledgerDimensionAccountController.loadAutoCompleteData(_e);

}

Code Example: Methods overridden on the SegmentedEntry control instance

 

 

 

5. override the following method on the datasource field that backs the SegmentedEntry control.

public Common resolveReference(FormReferenceControl _formReferenceControl)

{

    return ledgerDimensionAccountController.resolveReference();

}

Code Example: Method overridden on the datasource field that backs the SegmentedEntry control