web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to Add a filter to display method in Form

(1) ShareShare
ReportReport
Posted on by 405
Hello everyone, I hope you are all doing well.

I have a form that contains a grid that takes its data from a query, and I have a field of type display method that performs a simple operation. I want to add a filter factor that includes this field because I cannot filter the data in the display method naturally.

I tried some solutions like creating a View and adding a field linked to a Static method, but it didn't work correctly.

Thank you for listening to me.
I have the same question (0)
  • Suggested answer
    Ali AbdAlNasser Profile Picture
    405 on at
    How to Add a filter to display method in Form
    Hello everyone, I wish you a good day.

    I solved my problem by adding a filtering field and putting the filtering condition in it. I followed the steps in this article with some modifications: ExecuteQuery Method In D365 Forms
     
    Regarding the modifications I have applied, I have only made a minor change. Here is my edited version:
    public void executeQuery()
    {
       QueryBuildDataSource  queryBuildDataSource;
       queryBuildDataSource = this.query().dataSourceTable(tablenum(CustInvoiceTrans));
       queryBuildDataSource.clearRanges();
       if(MyComboBox.selection() == 1)
           queryBuildDataSource.addRange(fieldnum(CustInvoiceTrans, InvoiceId)).value(strFmt('INV*'));
       else if(MyComboBox.selection() == 2)
           queryBuildDataSource.addRange(fieldnum(CustInvoiceTrans, InvoiceId)).value(strFmt('!INV*'));
    
       super();
    }
    The code here value(strFmt('INV*')) represents Like in SQL and value(strFmt('!INV*')) represents Not Like in SQL.
    I stored the values All, FG, and INV in the ComboBox and then performed the filtering process as mentioned above.
    Thank you to everyone who helped me, I am grateful for that.
     
  • Raj Borad Profile Picture
    1,313 on at
    How to Add a filter to display method in Form
    Hi,
     
    Here is a solution provided for the AX 2012. You can check.
     
    Thank you,
    Raj
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,294 Super User 2025 Season 2 on at
    How to Add a filter to display method in Form
    Hi @Ali,
     
    Yes, you can't filter on a display method.
    I think you can create a query based tables or add your tables to datasource of your form.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Suggested answer
    Waed Ayyad Profile Picture
    8,876 Super User 2025 Season 2 on at
    How to Add a filter to display method in Form
    Hi,
     
    You can't filter the display method. Did you try to add the Items table to your Query? by adding the correct relationships or try to use temp table to fill the needed data at run time.
     
    You can check the following link it maybe helps you or the Temp table solution:
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
  • Ali AbdAlNasser Profile Picture
    405 on at
    How to Add a filter to display method in Form
    Hello everyone,

    I apologize if I have made any mistakes or if I have not explained my problem well.
    I will now clarify exactly what I want to do.

    What needs to be done:
    I have a Form containing a Grid that displays data from the tables CustInvoiceTrans, CustInvoiceJour, inventitemgroupitem, CustTable, DirpartyTable, and inventitemgroup. I have created a query and set up all the tables correctly as shown in the image:

    Now I have added this query to the Form as a data source, but there is a field that I need to perform a specific calculation on. I need to check the ItemID in the CustInvoiceTrans table. If it starts with a certain value, I give it a descriptive name; otherwise, it takes a generic name. I have adjusted this field by adding a Display Method, and I naturally added it to the Grid as shown:

    However, I later discovered that the Filter tool does not respond to data in this field, and I cannot filter it. So, I asked my question: How can I filter the Display Method?
    I hope this clarifies everything.
    Best regards.
  • Layan Jwei Profile Picture
    7,997 Super User 2025 Season 2 on at
    How to Add a filter to display method in Form
    Hi Ali,

    Display methods can't be filtered. If you need to filter on it then I think you need to convert it into an actual field.

    As for the view, can you show us what you did exactly?

    Thanks,
    Layan Jweihan
  • Martin Dráb Profile Picture
    235,966 Most Valuable Professional on at
    How to Add a filter to display method in Form
    Moved from Dynamics 365 general forum.
     
    Unfortunately I can't give you a solution of it didn't work correctly, because it can mean anything. You'll need to give us a better description of the problem.
  • Ali AbdAlNasser Profile Picture
    405 on at
    How to Add a filter to display method in Form
    My question revolves around D365 F&O forms and X++
  • Martin Dráb Profile Picture
    235,966 Most Valuable Professional on at
    How to Add a filter to display method in Form
    You're asking in the general D365 forum, but your question clearly is about a particular product. Which one? Is it F&O?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 823 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 673 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 491 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans