1. Create Main account Extension
2. Add a group Filter, Auto dec - Yes
3. Within the group add ComboBox control FilterType, Auto decl -Yes, Selection - 10(Profit Loss), Enum Type - DimensionLedgerAccountType
4. Also Add Filter Name -> Type String, Edt - Account Name
4. Create a class extension MainAccountForm_Extension, Add below methods
[FormControlEventHandler(formControlStr(MainAccount, FilterName), FormControlEventType::Modified)]
public static void FilterName_OnModified(FormControl sender, FormControlEventArgs e)
{
FormDataSource mainAccount_ds = sender.formRun().dataSource(formdatasourcestr(MainAccount,MainAccount));
mainAccount_ds.executeQuery();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(MainAccount, FilterType), FormControlEventType::Modified)]
public static void FilterType_OnModified(FormControl sender, FormControlEventArgs e)
{
FormDataSource mainAccount_ds =sender.formRun().dataSource(formdatasourcestr(MainAccount,MainAccount));
mainAccount_ds.executeQuery();
}
Points to remember
a. The control should be auto declared to Yes
b. On modified should call the execute query.
c. Execute query should define the range, it should check if the range exist if not create and then apply the range.
example qbrName = SysQuery::findOrCreateRange(qbds,fieldNum(MainAccount,Name));
d. In case of text match, use qbrName.value(SysQuery::valueLike(filterText)); else make it value unlimited qbrName.value(SysQuery::valueUnlimited());
No comments:
Post a Comment