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)

Date SysQueryRangeUtils

(0) ShareShare
ReportReport
Posted on by 55

We use the Dynamics AX standard queries to create queries for e.g. PriceDiscTable. Assume we want to have all PriceDiscTables for ItemNumber "xy" it's quite easy:

ItemRelation = xy

Additional we would like to retrieve only records that have a ValidTo date greater than yesterday.

ToDate: >day(-1)

So i would expect that a record with ToDate 2017/07/03 is part of this query. But it isn't. It doesn't matter which value i try, it will always display only those records with ToDate greater than today, that corresponds to ">day()".

You can simply reconstruct this behaviour in the TableBrowser for table PriceDiscTable.

If i use this expression in a simple job, it gives the expected output with date from yesterday:

info(strfmt(">%1",SysQueryRangeUtil::day(-1)));


Btw:

The function SysQueryRangeUtil::GreaterThanDate(-1) works like expected, but according to the documentation day(-1) should work as well.

Any ideas for this strange behaviour or do i miss something?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    (day(-1)) would work fine (although it's not useful in your case, as it returns a single date), while >day(-1) isn't a valid range value. You can't freely combine SysQueryRangeUtil methods with operators; that's why there are methods like greaterThanDate().

  • Jakob M Profile Picture
    55 on at

    Hi Martin,

    thanks for your reply.

    So it's unfortunately that AX doesn't complain about this combined use. Anyway, we'll stick to the method greaterThanDate().

  • Community Member Profile Picture
    on at

    For some reason it is not possible to combine greaterThanDate with "", like (greaterThanDate(-1)),"".

    If I filter on a table with empty date values it wont show me any records. Is there an alternative way to combine those two expressions?

  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    Yes, that's not a correct range value. You can create two ranges, one for the function and for the empty value.

  • Community Member Profile Picture
    on at

    But is there a way for the filter function in tables (strg + g) / combining both function?

  • Martin Dráb Profile Picture
    239,660 Most Valuable Professional on at

    Ctrl+G is just for the quick filtering of grids. Use Advanced Filter / Sort (Ctrl+F3) instead.

  • Community Member Profile Picture
    on at

    Oh - pretty simple :) Thank you.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dekion Profile Picture

dekion 4

#2
Virginia99 Profile Picture

Virginia99 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans