Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

AX 2012 Filter by Grid - Using dates

Posted on by Microsoft Employee

I have filterd by grid enabled on all forms. Now I want to filter on Date-Time fields. How can I filter all records by getting following results:

* All records where modify date between yesterday and now

* All records where modify date within the current month / year

* All records where modify date is today - 5 days untill now

* All records where modify date is previous week

...

Is this possible? Can I use e.g. "Today()-5 .. Today()" in a filter?

Regards,

Luk

*This post is locked for comments

  • dolee Profile Picture
    dolee 11,279 on at
    RE: AX 2012 Filter by Grid - Using dates

    Hi Ragnar,

    Like Martin said, you can extend SysQueryRangeUtil with your own method. And these methods can take parameters. However, I don't think you can specify a "tablerecord" as a parameter...more likely you'll be passing in the unique key field(s) to your method to find the records. Then build a query range from that.

    Cheers.

  • Ragnar Páll Profile Picture
    Ragnar Páll 25 on at
    RE: AX 2012 Filter by Grid - Using dates

    Hi,

    Can methods in SysQueryRangeUtil take parameters, like tablerecord. I whould like to compare two fields in record.

    Wbr,

    Ragnar Páll

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,149 Most Valuable Professional on at
    RE: AX 2012 Filter by Grid - Using dates

    You can use methods from SysQueryRangeUtil class for such scenarios (and add new methods if something can't be done with the existing ones).

    Example: (dayRange(-5, 0))

    Don't forget the outer parentheses, they're important there.

  • Verified answer
    dolee Profile Picture
    dolee 11,279 on at
    RE: AX 2012 Filter by Grid - Using dates

    Hi Luk,

    Please refer to this page:

    technet.microsoft.com/.../aa569937.aspx

    At the bottom of the table it mentions that "Type a SysQueryRangeUtil method with parameters that specify the value or range of values." with an example.

    You can then refer to the SysQueryRangeUtil class in AX. The "greaterThanDate" and "dayRange" methods seems to fit your needs, but there are other methods there that may fit better.

    Cheers.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans