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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filterring Grid via code

(0) ShareShare
ReportReport
Posted on by 6,648

Hi Guys;

I have a String Edit and I want to re filter grid by selecting item of String Edit. 

61661.1.png

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    I assume the grid is bound to a dataource.  

    You could use an event method (modified?) on the string edit control to call executeQuery on that datasource.
    In executeQuery, before the call to super(),

        depending on the circumstance,
            clear all ranges on the datasource and create a new range for the appropriate field
            clear the range on the appropriate field of the datasource
        grab the value of the string edit control and use it as the argument for the value() method of the range

  • Hossein.K Profile Picture
    6,648 on at

    Hi Rick,

    Can you explain me your scenario completement?

  • Verified answer
    Hossein.K Profile Picture
    6,648 on at

    This is Answer:

    1. Expand the StringEdit, right-click Methods, click Override methods, and then click LookUp. 
    public void lookup()
    {
        QueryBuildDataSource qbds;
        Query query = new Query();
        SysTableLookup sysTableLookup;
        super();
        sysTableLookup = SysTableLookup::newParameters(tableNum(Table1),this);
        qbds = query.addDataSource(tableNum(Table1));
        sysTableLookup.addLookupfield(fieldNum(Table1, RelatedId));
        sysTableLookup.parmQuery(query);
        sysTableLookup.performFormLookup();
    }


    2.Expand the StringEdit, right-click Methods, click Override methods, and then click modified.


    public boolean modified() { boolean ret; ret = super(); Table1_ds.executeQuery(); return ret; }

     

    3. Expand the Methods node of the form, right-click classDeclaration,


    public class FormRun extends ObjectRun { QueryFilter queryFilter; }


    4. Expand the Data Sources node, and then find the table that has the field that has the values that you will use to filter the list.

    5. Expand the table node, right-click Methods, click Override method, and then click init.


    public void init() { super(); queryFilter = Table1_ds.query().addQueryFilter(Table1_ds.queryBuildDataSource(),"relatedID"); }
    
    


    6.In the same table, right-click the Methods, click Override method, and then click executeQuery.


    public void executeQuery() { queryFilter.value(element.design().controlName("StringEdit").valueStr()); 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans