Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Add custom filter in ListPage D365FO

(0) ShareShare
ReportReport
Posted on by 123

Hi,

I am trying to add a custo filter to a standart ListPage. I have tried to call executequery() of datasource in onmodified event handler of the control and 

added the range in in executingQuery() but it does not work.  The field that I am trying to filter is a display field, so what I am trying to do is change the query of the listpage every time the filter is modified( changing the logic) I have searched online about adding custom filters in listPAge in AX7 but I have not found valuable information.  What should I do to add a custom filter to standart listPage in AX7?

Thanks,

Enxhi

*This post is locked for comments

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Add custom filter in ListPage D365FO

    Could you try to print (formdatasource).queryRun().query().toString() in the onQueryExecuted event and see if there's something interesting there.

  • Enxhi Bregu Profile Picture
    Enxhi Bregu 123 on at
    RE: Add custom filter in ListPage D365FO

    The query is ok. I use clearRange() and I am not understanding what is wrong in this case.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Add custom filter in ListPage D365FO

    Most likely after the first succesful run you end up having "trash" from previous executions in the query. Try to print the query to the infolog in the end of your method to verify this (query.toString()).

    Once you see what's in the query, you might figure out how to fix it.

  • Enxhi Bregu Profile Picture
    Enxhi Bregu 123 on at
    RE: Add custom filter in ListPage D365FO

    The filter works the first time, than If I remove the value from filter it shows nothing, and if I try again a value, it does not work.

    I  am writing this in onexecutequery:

    QueryBuildDataSource qbsdBankDoc   = BankDocumentTableView_ds.query().dataSourceTable(tableNum(BankDocumentTableView));
    
           QueryBuildDataSource qbdsBankTrans = qbsdBankDoc.addDataSource(tableNum(BankAccountTrans));
    
           //QueryBuildRange qbr = qbdsBankTrans.addRange(fieldNum(BankAccountTrans, BankTransAmountCur));
    
           qbdsBankTrans.addLink(fieldNum(BankDocumentTableView,SourceRecId), fieldNum(BankAccountTrans, RecId));
    
           qbdsBankTrans.addLink(fieldNum(BankDocumentTableView,SourceRelationType), fieldNum(BankAccountTrans, TableId));
    
           qbdsBankTrans.joinMode(JoinMode::InnerJoin);
    
          
    
           //qbdsBankTrans.clearRange(fieldNum(BankAccountTrans, BankTransAmountCur));
    
           if(debit.realValue())
    
           {
    
               qbdsBankTrans.clearRange(fieldNum(BankAccountTrans, BankTransAmountCur));
    
               qbdsBankTrans.addRange(fieldNum(BankAccountTrans, BankTransAmountCur)).value(SysQuery::value(debit.realValue()));
    
               
    
           }
    
           else
    
           {
    
               qbdsBankTrans.clearRange(fieldNum(BankAccountTrans, BankTransAmountCur));
    
               //qbdsBankTrans.addRange(fieldNum(BankAccountTrans, BankTransAmountCur)).value(SysQuery::valueUnlimited());
    
           }
  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Add custom filter in ListPage D365FO

    Could you share some more information on how you try to add your range to the query?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans