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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
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

I have the same question (0)
  • Verified answer
    David Massey Profile Picture
    Microsoft Employee on at

    Try looking at the query object returned by QueryRun().Query().

  • Andrew Huey Profile Picture
    110 on at

    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
    Microsoft Employee on at

    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
    110 on at

    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!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans