Tuesday, January 31, 2023

How to get particular vendor tax information of a purchase order in lookup from TaxInformation_In using x++

[FormControlEventHandler(formControlStr(PurchTable, PurchTable_Description), FormControlEventType::Lookup)]   

public static void PurchTable_Description_OnLookup(FormControl sender, FormControlEventArgs e) 

{        

VendTable   vendTable;        

PurchTable  purchTable,purchTable1; 

TaxInformation_IN   taxInformation_IN;        

LogisticsLocation   logisticsLocation;                

 DirPartyTable  dirPartyTable;        

TaxInformationName  tax;        

str name1;           

FormStringControl Name;        

Query query = new Query();        

QueryBuildDataSource queryBuildDataSource;        

QueryBuildRange queryBuildRange;        

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(TaxInformation_IN), sender);        

FormRun formRun;        formRun = sender.formRun();        

purchTable     = formRun.dataSource().cursor();        

vendTable= vendTable::find(purchTable.OrderAccount);        

dirPartyTable = DirPartyTable::findRec(vendTable.Party);        

logisticsLocation = LogisticsLocation::find(dirPartyTable.PrimaryAddressLocation);        

taxInformation_IN = TaxInformation_IN::findDefaultbyLocation(logisticsLocation.RecId);          

queryBuildDataSource = query.addDataSource(tableNum(TaxInformation_IN));        

sysTableLookup.addLookupField(fieldNum(TaxInformation_IN, Name));          

queryBuildRange = queryBuildDataSource.addRange(fieldNum(TaxInformation_IN,RecId));        

queryBuildRange.value(SysQuery::value(taxInformation_IN.RecId));        

sysTableLookup.parmQuery(query);        

sysTableLookup.performFormLookup();    

No comments:

Post a Comment