Lookup in UI Builder Class with multiple Tbales D365fox++
public void lookupVendorID_New(FormStringControl _control)
{
PurchTable purchtable;
PurchLine purchline;
VendInvoiceJour vendInvoiceJour;
GeneralJournalEntry GeneralJournalEntry ;
GeneralJournalAccountEntry GeneralJournalAccountEntry;
VendTable vendtable;
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SysTableLookup systablelookup;
SalesTable salesTable;
query = new Query();
qbds = query.addDataSource(tableNum(vendtable));
//New Lookup
sysTableLookup = SysTableLookUp::newParameters(tableNum(vendtable), _control);
sysTableLookup.addLookupfield(fieldNum(vendtable, AccountNum));
while
select ACCOUNTNUM
from VENDTABLE
join purchtable
where purchtable.ORDERACCOUNT == VENDTABLE.ACCOUNTNUM
&& purchtable.DATAAREAID == VENDTABLE.DATAAREAID
join vendinvoicejour
where vendinvoicejour.PurchId == purchtable.PurchId
join GeneralJournalEntry
where GeneralJournalEntry.SubledgerVoucher == vendInvoiceJour.LedgerVoucher
join GeneralJournalAccountEntry
group by VENDTABLE.ACCOUNTNUM
where GeneralJournalAccountEntry.GeneralJournalEntry == GeneralJournalEntry.RecId
&& (GeneralJournalAccountEntry.PostingType == LedgerPostingType::PurchAdvance || GeneralJournalAccountEntry.PostingType == LedgerPostingType::PurchAdvanceApplication)
&& VENDTABLE.DATAAREAID == curExt()
{
qbr = qbds.addRange(fieldNum(vendtable, AccountNum));
qbr.value(VENDTABLE.ACCOUNTNUM);
}
if(!VENDTABLE)
{
qbr = qbds.addRange(fieldNum(vendtable, AccountNum));
qbr.value("--Don't Remove Filter--");
}
qbr.status(RangeStatus::Hidden);
systablelookup.parmUseLookupValue(false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Comments
Post a Comment