Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Getting user filter values from a grid

(0) ShareShare
ReportReport
Posted on by 110

I'm working on a form customization right now, on the InventOnhandItem form. As part of this customization, I need to retrieve any values that the user has typed into the "ctrl-g" filter fields.

I thought that maybe I could figure this out by looking at the query, but these filters don't seem to be added to the query. (Either that, or I'm looking at the wrong query.)

I'm wondering if there's a way to just iterate through the filter fields and pull the values from them, but I haven't been able to figure that out. Any help would be appreciated. Thanks!

*This post is locked for comments

  • Andrew Huey Profile Picture
    Andrew Huey 110 on at
    RE: Getting user filter values from a grid

    David -

    Strangely enough, the SysQuery class on my system doesn't have the queryHasFilters() static method in it. I can see that someone else at my company had made some changes to SysQuery at some point, so I guess maybe it got accidentally deleted at some point.

    Regardless, though, I see that I need to look at QueryFilter rather than range, so I'm on the right track.

    Thanks!

  • Verified answer
    David Massey Profile Picture
    David Massey on at
    RE: Getting user filter values from a grid

    The values are not treated as ranges to the query.  Instead they are filters.  Additional pieces of code to look at are SysQuery::queryHasFilters(), QueryFilter object which has the information for datasource, field, and value.

  • Andrew Huey Profile Picture
    Andrew Huey 110 on at
    RE: Getting user filter values from a grid

    David - Yes, that was pretty much what I was looking for, thanks.

    If I do:

       qbds = InventSum_ds.queryRunQueryBuildDataSource();

       info(qbds.toString());

    then, I see the query with the expected 'where' clause.

    My next issue, though, is that I haven't figured out how to extract the filters from the QueryBuildDataSource object.

    Using qbds.findRange(...) doesn't seem to return them as I would expect.

    I'm wondering if I'm doing something wrong (again), or if it's just not possible to extract the user filters that way.

  • Verified answer
    David Massey Profile Picture
    David Massey on at
    RE: Getting user filter values from a grid

    Try looking at the query object returned by QueryRun().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…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans