Filtering Records in a Form - Microsoft Dynamics Axapta

Hello Guys...


In this post i'm sharing steps how to do the Filtration of records in a Form

Here  i'm filtering records based on the selected gender(m/f)

Step 1 :

Go to Form-> Methods->class declaration and declare QueryBuildRange.

public class FormRun extends ObjectRun
{
    QueryBuildRange range;
}

Step 2:
Go to Data sources->your datasource->Add a Range in init() method of the DataSource.

public void init()
{
    super();
    range = this.query().dataSourceName("Test_Filteration").addRange(fieldNum(Test_Filteration,Gender));
}
//Note : You can use dataSourceNo also

Step 3 :

Go to Data sources->your datasource->Override the executeQuery() method


public void executeQuery()
{
    range.value(Gender.valueStr());
    super();
}

//Note : Enable "Gender"Auto-declaration to "Yes" in design

Step 4 :

Finally  Call the executeQuery() method in the Selection Changed method of the ComboBox(Gender).


public int selectionChange()
{
    int ret;

    ret = super();
    Test_Filteration_ds.executeQuery();
    return ret;
}




@ Rahul Talasila

Comments

Popular posts from this blog

Filter Records on Item Lookup Through X++ - Ax 2012

How to Install Management Reporter in Ax 2012 R3

Settle Vendor Invoice/Payment through X++ code - AX 2012