Thursday 13 April 2017

Filtering SegmentedEntry Control Based On Account Type Selected.

SegmentedEntry Control Based On Account Type:





  1. Create a form 
  2. Override form Init and write below code 
  3. Take data source as LedgerJournalTrans

public class FormRun extends ObjectRun
{
    DimensionDynamicAccountController   dimAccountController;
    
}
public void init()
{
    super();
    dimAccountController = DimensionDynamicAccountController::construct(ledgerJournalTrans_ds,
                                    fieldStr(LedgerJournalTrans, LedgerDimension),
                                    fieldStr(LedgerJournalTrans, AccountType));
}

 3.Under design override two controls i.e ComboBox and Segmented Entry control

 4.Under Segmented Entry control override below methods and set below code & properties



public void jumpRef()
{
    dimAccountController.jumpRef();
}
public void loadAutoCompleteData(LoadAutoCompleteDataEventArgs _e)
{
    super(_e);
    dimAccountController.loadAutoCompleteData(_e);
}
public void loadSegments()
{
    super();
    dimAccountController.parmControl(this);
    dimAccountController.loadSegments();

}
public void lookup()
{
    switch (LedgerJournalTrans.AccountType)
    {
        case LedgerJournalACType::Bank:
            BankAccountTable::lookupBankAccount(this);
            break;
        case LedgerJournalACType::Cust:
            CustTable::lookupCustomer(this);
            break;
        case LedgerJournalACType::FixedAssets:
            AssetTable::lookupAccountNum(this);
            break;
        case LedgerJournalACType::Ledger:
            super();
            break;
        case LedgerJournalACType::Vend:
            VendTable::lookupVendor(this);
            break;

        default:
            super();
            break;
    }
}
public Common resolveReference()
{
    Common ret;

    ret = dimAccountController.resolveReference();

    return ret;
}
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
{
    super(_e);

    dimAccountController.segmentValueChanged(_e);
}
public boolean validate()
{
    boolean isValid;

    isValid = super();
    isValid = dimAccountController.validate() && isValid;

    return isValid;
}


References:

http://axgenius.blogspot.in/2016/08/how-to-filter-segmented-entry-based-on.html

https://community.dynamics.com/ax/b/mukeshhirwani_dynamicsax/archive/2012/06/14/segmented-entry-control-on-forms-in-dynamics-ax-2012-ledger-dimension-ledger-account-lookup-x

1 comment:

  1. Thanks for sharing this nice and informative post. Keep me more updating. Building a Financial Model

    ReplyDelete