Question Status

Verified
Andrew Huey asked a question on 28 Mar 2013 12:31 PM

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

Reply
Verified Answer
David Massey responded on 28 Mar 2013 1:15 PM

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

David Massey | Senior software engineer - Dynamics AX Service Industries

Reply
Andrew Huey responded on 28 Mar 2013 2:25 PM

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.

Andrew Huey | SHI | Developer

Reply
Verified Answer
David Massey responded on 28 Mar 2013 3:36 PM

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.

David Massey | Senior software engineer - Dynamics AX Service Industries

Reply
Andrew Huey responded on 29 Mar 2013 5:37 AM

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!

Andrew Huey | SHI | Developer

Reply
Verified Answer
David Massey responded on 28 Mar 2013 1:15 PM

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

David Massey | Senior software engineer - Dynamics AX Service Industries

Reply
Verified Answer
David Massey responded on 28 Mar 2013 3:36 PM

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.

David Massey | Senior software engineer - Dynamics AX Service Industries

Reply