Filter Records in Form by using Combo Box in AX 2012
Today I will demonstrate you that How to Filter records in form by using Combo Box in AX 2012.
1) Create a Table Named “FilterDemo”
and add some fields like Name, Eid, Salary and Add one Base Enum Like Gender.
2) Enter some Data into the
Table.
3) Create a form Name
“FiletrDemoForm”.Drag the FilterDemo Table to the DataSource of the form.
4) Under the Design node of the Form.Create a New
Control àTabàTab Page.
Change the properties of the TabPage Like
this
Name:- General
Caption:-General
5) Now Add a new controlàGrid to the TabPage.Now Drag the Fields Which should Appear
in the Form to the Grid control from DataSource.
6) Under the Same Tab Page Add a
NewGroup. Under the NewGroup add a new control called ComboBox. Change the
property AutoDeclaration of the comboBox to YES and BaseEnum to Gender.
7) Now the form creation is
complete. Now We need to see the filtering the Record.
8) Now Declare the range In the
classDeclaration of the form.
public class FormRun extends
ObjectRun
{
QueryBuildRange qrGender;
}
9) Add a Range in init() method of
the DataSource.
public void init()
{
super();
qrGender=this.query().dataSourceNo(1).addRange(fieldNum(FilterDemoTable,Gender));
}
10) Override the executeQuery()
method of the DataSource.
public void executeQuery()
{
qrGender.value(ComboBox.valueStr());
super();
}
11) Call the executeQuery method in
the SelectionChanged method of the ComboBox.
public int selectionChange()
{
int
ret;
ret = super();
FilterDemoTable_ds.executeQuery();
return
ret;
}
12) Now compile and save your form and open.
Comments
Post a Comment