Create a custom look up on table and how to call on Form
today we have a requirement to show the custom all addresses on the standard form
1) create a lookup on the table so that it can be reused
2) Call the above lookup method on form control Below are the xample
Create a lookup :-
/// <summary>
/// look up for customer lookup
/// </summary>
static void ihslookupCustAddress(FormStringControl _callingControl, CustAccount _custAct)
{
Query query = new Query();
QueryBuildDataSource qbds, qbds2, qbds3;
QueryBuildDataSource QbdsJoin;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(DirPartyPostalAddressView), _callingControl);
qbds = query.addDataSource(tableNum(DirPartyPostalAddressView));
qbds.addGroupByField(fieldnum(DirPartyPostalAddressView, Address));
qbds.orderMode(OrderMode::GroupBy);
qbds2 = qbds.addDataSource(tableNum(CustTable));
qbds2.addLink(fieldNum(DirPartyPostalAddressView, Party), fieldNum(CustTable, Party));
qbds2.joinMode(JoinMode::ExistsJoin);
qbds2.addRange(fieldNum(CustTable, AccountNum)).value(queryValue(_custAct));
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupfield(fieldNum(DirPartyPostalAddressView, Address));
sysTableLookup.performFormLookup();
}
===================================================================
Call on the form control :-
[ExtensionOf(formControlStr(EntAssetWorkOrderTable, AuctionPlan_Address))]
Final class IHSEntAssetWorkOrderTableFrm_AddressCtrl_Extension
{
public void lookup()
{
FormStringControl auctionPlan_fsc = any2Object(this) as FormStringControl;
FormDataSource auctionPlan_ds = auctionPlan_fsc.formRun().dataSource(tableStr(IHSAuctionPlan));
IHSAuctionPlan auctionPlan = auctionPlan_ds.cursor();
next lookup();
IHSAuctionPlan::ihslookupCustAddress(this, auctionPlan.CustAccount);
}
}
====================================================================
Comments
Post a Comment