Tuesday, October 28, 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

1 comment:

  1. Great tutorial, Rahul! Filtering records by user selection is such a common requirement, and your explanation makes it super simple to implement in AX. On a different note, for those curious about AI in computer vision, this comparison on detr transformer object detection gives some solid insights into how modern models are evolving.

    ReplyDelete

What is the primary purpose of using a Solution in Microsoft Power Platform & ALM?

As organizations embrace low-code development with Microsoft Power Platform , it becomes essential to manage and govern apps, flows, and dat...