Filtering Records in a Form



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;
}

   






6 comments:

  1. how to add greater than in the query.

    ReplyDelete
  2. I want to execute the query on date value smaller than the entered date.

    ReplyDelete
  3. I need to display filtered records in the grid but the grid is in different data source and the records are in different data source.

    ReplyDelete
  4. hi anil thanks for posting this, i would like to create one stringedit filed in form based on
    the entered data filed in data has filter in grid do you solution for this.

    thnks in advance

    ReplyDelete
    Replies
    1. https://msdaxerp.wordpress.com/2013/07/20/filtering-the-form-through-code/

      Delete