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!
Andrew Huey | SHI | Developer
Try looking at the query object returned by QueryRun().Query().
David Massey | Senior software engineer - Dynamics AX Service Industries
David - Yes, that was pretty much what I was looking for, thanks.
If I do:
qbds = InventSum_ds.queryRunQueryBuildDataSource();
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.
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.
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.