Using Methods in Table Filters & Query Ranges in AX 2012

read

In Microsoft Dynamics AX, there is a class called SysQueryRangeUtil that can be utilized in both query ranges and table filters. Using methods from this class allows you to be very precise about which dates you want to use in reports or for filtering your data.

Let’s say you always want to run a report that shows orders with shipping dates of the next day. You can do this by using one of the methods from the SysQueryRangeUtil. The use of the letter ‘t’ will work for today’s date, but when you try to add days to it, it doesn’t work in reports. Instead, use the currentdate() method and add 1 to it.

Note: All methods & expressions must be surrounded by parentheses.

Filtering the Requested Ship Dates 

On any form with a grid, you filter your data by pressing Ctrl+G. If you want to see open customer invoices from the last 90 days, filter your open customer invoices form and use the method (dayRange(-90,0)). The first number represents how many months backward from this month, and the second represents how many months forward. The same sorts of things can be done for the monthRange()yearRange(), and dateRange() methods. The best part about this is that you are able to save these filters to create views that you use on a daily basis.

If you are creating your query ranges in code, use these methods whenever you are setting them. Be sure to check out the SysQueryRangeUtil class as there are many more methods to use.

Here are some of them:
currentCustomerAccount()
currentVendorAccount()
currentUserId()
currentDate()
dateRange()
day()
dayRange()
greaterThanDate()
greaterThanUtcDate()
greaterThanUtcNow()
lessthanDate()
lessthanUtcDate()
lessthanUtcNow()
monthRange()
yearRange()

If you have questions about using methods in table filters & query ranges in Microsoft Dynamics AX 2012, fill out the question section below.

As Vice President of Digital Transformation at Blue Horseshoe, Steve Shebuski guides businesses through their digital transformation journey. Steve has 20+ years of experience as a Program Manager/Design Lead/Project Manager implementing both Microsoft Dynamics AX / Dynamics 365 as well as tier I and tier II warehouse management and transportation software solutions. Steve's deep knowledge within the distribution industry and his innovative approach to solution architecture are the backbone of the solution implementation and deployment by Blue Horseshoe.

Learn How Others Have Improved Their Supply Chain Operations With Blue Horseshoe

Supply Chain Technology

D365 Wave Updates (Updated for 2021)

Read More
Dynamics 365 ERP

Overcoming Cloud ERP Misconceptions: Your Guide to D365

Read More

How to Develop a Warehouse Inventory Cycle Counting Process

Read More