Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Filtering form

Posted on by Microsoft Employee

I created a query and made a grid on the form, but when I I filter it still shows blank stuff under it.  If I filter for

100 it will show me everything with 100, but if there are fields that are empty in that column, it still shows them as well. Is there a setting a missed?

*This post is locked for comments

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Filtering form

    You are adding the filter then probably on the wrong table/field if it does not do the filtering for you, since there is no difference between the advance filter screen and the filtering above the grid, or by the field - they all use the same mechanics, so you must be applying the range to the wrong datasource.field.

    The findorcreaterange is no different from the addrange, you would just pass in this.queryBuildDataSource() in the init of the inventdim table (if that is what you want to apply the range for), instead of referring it through the query.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filtering form

    I went to your link and followed their instructions. I put this line of code in my init of the datasource.

    this.query().dataSourceName('InventDim_1').addRange(fieldnum(InventDim,WMSLocationId)).value(queryvalue('6*'));

    The problem is, for one, It's filtering as "6\*" for some reason, and even if it was filtering by what it should be, it's doing the same thing as before. Where it shows the empty records where I filter unless I go into the advanced querying.

    I'm not quite sure on how to use SysQuery::findOrCreateRange this is what I found someone else using, but it doesn't seem to be working for me. Getting a syntax error under  the dataSourceNo(1).

  • Verified answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Filtering form

    The filtering in the client is per user unfortunately. If you want it to be permanent, then the range has to be created on that form by a developer in the init method of the datasource.

    dynamics-ax-live.blogspot.co.uk/.../how-to-filter-records-in-form-by-code.html

    I would use SysQuery::findOrCreateRange in the init, if you always want to filter by a specific value.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filtering form

    Vilmos,

    It looks like you were right. When I looked at the advance filtering query it was only showing 2 fields, when I tried to filter from those fields it worked correctly.

    So I added in the field that I wanted and it fixed it.

    How can I make it stay permanent so users don't run into this problem?

  • Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Filtering form

    On the columns insidie the grid select Right click > Personalize > System name value to see what tables are in there and whether they are all the same, or different. Alternatively check the Query tab like I suggested above.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filtering form

    In the screenshot I'm filtering the Pattern column by 1001, you can see that it shows 7 records or so, but after that, it continues to show the empty fields. It'll do that no matter what column I filter.

    https://imgur.com/SYfMS6h

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Filtering form

    I created a range in a query. It's not code, so it seems to be user.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Filtering form

    You can press Control + F3 to see the advanced query filter criterias on your form. If the same field shows multiple times, it acts as an OR operation.

    You can also right click on a form control > Personalize > Query tab and see what your relations and ranges are, maybe you will see there what is wrong or missing.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,253 Super User 2024 Season 2 on at
    RE: Filtering form

    Hi Conficker,

    Please tell more about your customization and the current scenario. Would it be possible to share a screenshot, so we can understand what you are actually trying to ask?

  • XB Profile Picture
    XB 1,867 on at
    RE: Filtering form

    How are you filtering by code (x++) or as user?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans