FormControl LookUp:
[FormControlEventHandler(formControlStr(SalesTable, DiplItemProductType), FormControlEventType::Lookup)]
public static void DiplItemProductType_OnLookup(FormControl sender, FormControlEventArgs e)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), sender);formRun = sender.formRun();
QueryBuildDataSource qbdsProduct,qbdsInvent;
Query query;
FormRun formRun;
FormControl formCtrl;
formCtrl = formRun.design().controlName(formControlStr(SalesTable, DiplItemProductType));
query = new Query();qbdsInvent = query.addDataSource(tableNum(InventTable));
qbdsProduct = qbdsInvent.addDataSource(tableNum(EcoResProduct));
qbdsProduct.addLink( fieldNum(InventTable, Product), fieldNum(EcoResProduct, RecId));
qbdsProduct.addRange(fieldNum(EcoResProduct, ProductType)).value(SysQuery::value (EcoResProductType::Service));
sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId), true);
sysTableLookup.addLookupfield(fieldNum(InventTable, ItemType), true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
FormControl Modified:
[FormControlEventHandler(formControlStr(SalesTable, SalesLine_ItemId), FormControlEventType::Modified)]
public static void SalesLine_ItemId_OnModified(FormControl sender, FormControlEventArgs e)
{
FormRun element = sender.formRun();
FormControl itemidctrl = element.design(0).controlName("SalesLine_ItemId");
FormDataSource SalesLine_ds = element.dataSource(formDataSourceStr(SalesTable, SalesLine)) as FormDataSource;
SalesLine salesLine = SalesLine_ds.cursor();
salesLine.DiplItemId = itemidctrl.valueStr();}
Modified method for unbound controls of a form
Grid field appear/disappear based on field status
My scenario : Based on unbound enum field in form, grid field should be apper/disapper.
Solution: I have copied onmodified event for filed and created and pasted in new class as shown below.
class DIPLCustomerEH
{
[FormControlEventHandler(formControlStr(DIPLCustomer, DIPLCustomer_AccountType), FormControlEventType::Modified)]
public static void DIPLCustomer_AccountType_OnModified(FormControl sender, FormControlEventArgs e)
{
}FormRun element = sender.formRun();FormComboBoxControl schemactrl = element.design(0).controlName("DIPLCustomer_AccountType");FormDataSource DIPLCustomer_ds = element.datasource(FormDataSourcestr(DIPLCustomer,DIPLCustomer)) as FormDataSource;FormDataObject schema = DIPLCustomer_ds.object(fieldNum(DIPLCustomer, Sechema));if(schemactrl.selection() == DIPLAccountType::Debit){
schema.visible(false);}else{schema.visible(true);}
}
No comments:
Post a Comment