Tuesday, 28 October 2014

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

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...