Title: How to Create Lookup by Account Type using DimensionDynamicAccountController?
Tags: forms;axapta;lookup;dynamics-ax-2012;x++
Question: I have a problem.
I have in my new table two new fields
1) Name -> AccountNum, EDT--> DimensionDynamicAccount
2) Name -> AccountType, EDT--> LedgerJournalACType
class declaration
public class FormRun extends ObjectRun
DimensionDynamicAccountController dimAccountController;
init (for the form):
public void init()
super();
dimAccountController = DimensionDynamicAccountController75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0onstruct(
MyTable_ds,
fieldstr(MyTable, LedgerDimension),
fieldstr(MyTable, AccountType));
4. Override the following methods on the Segmented Entry control instance in the form design.
public void jumpRef()
dimAccountController.jumpRef();
public void loadAutoCompleteData(LoadAutoCompleteDataEventArgs _e)
super(_e);
dimAccountController.loadAutoCompleteData(_e);
public void segmentValueChanged(SegmentValueChangedEventArgs _e)
super(_e);
dimAccountController.segmentValueChanged(_e);
public void loadSegments()
super();
dimAccountController.parmControl(this);
dimAccountController.loadSegments();
public boolean validate()
boolean isValid;
isValid = super();
isValid = dimAccountController.validate() &amp;&amp; isValid;
return isValid;
5. Override the following methods on the data source field that backs the Segmented Entry control.
public Common resolveReference(FormReferenceControl _formReferenceControl)
return dimAccountController.resolveReference();
Now my problem is Lookup only works for AccountType=="Ledger" not for customer, Vendor etc...
If I have a AccountType == Vendor or similant but different to Ledger I see this
I would want to have same the same thing that's in the LedgerJournalTrans Form
There is a solution,
thanks all,

Here is the accepted answer: This might be too obvious, but I think you're missing the lookup() method.
\Forms\LedgerJournalTransDaily\Designs\Design\[Tab:Tab]\[TabPage:OverViewTab]\[Grid:overviewGrid]\SegmentedEntry:LedgerJournalTrans_AccountNum\Methods\lookup
public void lookup()
if (!ledgerJournalEngine.accountNumLookup(ledgerJournalTrans_AccountNum,
ledgerJournalTrans,
ledgerJournalTrans.OffsetAccountType,
ledgerJournalTrans.parmOffsetAccount(),
ledgerJournalTrans_Asset))
super();
Comment for this answer: Very Thanks @Alex Kwinty, you have been very helpful! Good work!


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:11/18/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<forms><axapta><lookup><dynamics-ax-2012><x++>', 'Title': 'How to Create Lookup by Account Type using DimensionDynamicAccountController?', 'ViewCount': 852, 'id': 40679948, 'user_AboutMe': '<p>nemo enim nascitur didicit</p>\n', 'user_AccountId': 6118315.0, 'user_DisplayName': 'ulisses', 'user_Reputation': 1407.0, 'user_Views': 253.0, 'user_id': 4772627.0}}