Create Lookup form with LedgerAccount from Trial Balance

Hi all,

Thanks for reading my question.

I want to create lookup form lookup all “LedgerAccount” in “General ledger - Common - TrialBalance”.

I tried but my code show all value in table Main Account, how can i make value show only Account in “LedgerAccount”

Thanks very much !

(Below is my lookup code)

public void mainAccountLookup(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SysTableLookup sysTableLookup;
container con;

qbds=query.addDataSource(tableNum(MAINACCOUNT));
qbr = qbds.addRange(fieldNum(MAINACCOUNT, MainAccountId));
sysTableLookup = SysTableLookup::newParameters(tableNum(MAINACCOUNT), _control);
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupfield(fieldNum(MAINACCOUNT, MainAccountId));
sysTableLookup.addLookupfield(fieldNum(MAINACCOUNT, Name));
sysTableLookup.performFormLookup();

}

The trail balance may not be showing all the ledger accounts and the way the data fetched on a trial balance is different. It uses posted ledger transactions to get the data.

What is the purpose of showing only the accounts shown in TB in the accounts lookup?

There is an existing method in MainAccount table \Data Dictionary\Tables\MainAccount\Methods\lookupMainAccount