Custom Filter Creation on AX 2009 Form

I am designing a log form. Here I have a Enum field named Module which has 2 Elements AP,AR. Now i am creating a filter using Combo Box. My filter is working fine , i.e; when i select AP in Combo Box All AP records are shown and when i select AR all AR records are shown but the problem is how to display both at a time.

For this i Created one more Element in Enum as All and tried the following code but it is not working.

Example:

public void executeQuery()
{
if(Module.valueStr() == “Accounts Payable”)
{
qrModule.value(Module.valueStr());
}
else if(Module.valueStr() == “Accounts Receivable”)
{
qrModule.value(Module.valueStr());
}
else if(Module.valueStr() == “ALL”)
{
qrModule.value(enum2str(PEPSModule_RBT::AR));
qrrModule.value(enum2str(PEPSModule_RBT::AR));
}

}

What’s the point of your code for “ALL”? Assuming that qrrModule is a typo, it sets the same filter to the same range twice.

By the way, you have many weird things in your implementation, such as hard-code texts in one specific language. Let me show you nicer code:

public void executeQuery()
{
    switch (Module.selection())
    {
        case YourModuleFilter::SalesOrder:
            qrModule.value(queryValue(ModuleAxapta::SalesOrder));
            break;
        case YourModuleFilter::PurchaseOrder:
            qrModule.value(queryValue(ModuleAxapta::PurchaseOrder));
            break;
        default:
            qrModule.value(SysQuery::valueUnlimited());
    }

    super();
 }

Don’t forget that you told us little about your implementation (e.g. whether the field and the filter use the same enum), therefore I merely guessed some parts. You may need to modify the code to meet your specific needs.

(Question moved from the Technical forum.)

Hi Martin,

Thanks A Ton,

Thanks & Regards

Syed

If it answered your question, please close the thread by marking the reply as the verified answer.