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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Remove Filter from List Page

(0) ShareShare
ReportReport
Posted on by

Dear Expert

How to remove filter from List Page

as per below coding

public void executeQuery()
{
QueryBuildRange QcustomerFilter;

this.Query().datasourceNo(1).clearRanges();


QcustomerFilter = SysQuery::findOrCreateRange(vendtrans_q.datasourceTable(tableNum(VendTrans)),fieldNum(VendTrans,AccountNum));

if (txtvendorcode.text()!="")
{
QcustomerFilter.value(queryValue(txtvendorcode.text()));
}
else
{
QcustomerFilter.value(SysQuery::valueUnlimited());
}

super();



}

image is attached

Thanks

2843.grid.png

*This post is locked for comments

I have the same question (0)
  • Dick Wenning Profile Picture
    8,705 Moderator on at

    is this a question or the solution?

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    Your line of code

    this.Query().datasourceNo(1).clearRanges();

    really should be

    this.queryBuildDataSource().clearRanges();

    or

    this.queryRunQueryBuildDataSource().clearRanges();

    The problem with datasourceNo(1) is that it just assumed the correct data source will be found.  It might work today, but it's a poor practice.  It's the kind of thing that breaks later and leaves you scratching your head, where better practices continue to work through upgrades and changes.

    There's also an important different between the queryBuildDataSource (the source query) and the queryRunQueryBuildDataSource (the running query).  It shouldn't matter in your specific case.

    In your findOrCreateRange statement, you use vendtrans_q instead of this.query(), and venttrans_q is not initialized anywhere in your code block, so we have no idea where that comes from.  That could all by itself be responsible for your code not working.

    Again, consider

    SysQuery::findOrCreateRange(this.queryBuildDataSource(), 

    instead of

    SysQuery::findOrCreateRange(vendtrans_q.datasourceTable(tableNum(VendTrans)),
  • Community Member Profile Picture
    on at

    Hi Dick

    This is problem i am having

    Thanks

  • Community Member Profile Picture
    on at

    Thanks Brandon i try below but issue not resolved

    this.queryBuildDataSource().clearRanges();

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi,

    give a try to below statement

    VendTrans_ds.queryBuildDataSource().clearRanges();

    //DataSourceName_DS.queryBuildDataSource().clearRanges();

  • Community Member Profile Picture
    on at

    Thanks Sohaib i try but not working. My data source is bind to query.

    On another form my data source bind to "SalesLine" table and it is working fine.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    are you sure that 'Vendor Account' is coming from VendTrans...??

    what is field name if you right click on it and click personalize

  • Community Member Profile Picture
    on at

    Vendtrans.png

  • Community Member Profile Picture
    on at

    executequery works for first time next time i have to remove search from list page because last searches remain on list page

    i have created other form from salesline table same functionality working fine

    Thanks

  • Community Member Profile Picture
    on at

    Looking for support for below code can not clear the filter....Thanks

    public void executeQuery()

    {

    if (txtvendorcode.text()!="")

     {

        SysQuery::findOrCreateRange(VendTable_ds.query().dataSourceTable( tableNum(VendTable)),fieldNum(VendTable,AccountNum)).value(SysQuery::value(txtvendorcode.valueStr()));

     }

    else

     {

         Vendtable_ds.queryBuildDataSource().clearRanges();   //Not Working

         SysQuery::findOrCreateRange(VendTable_ds.query().dataSourceTable(tableNum(VendTable)),fieldNum(VendTable,AccountNum)).value(SysQuery::valueUnlimited());

     }

    super();

    }

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans