6/29/2015

Relative date filtering and other tricky filters - Relatív dátum szűrés és egyéb trükkös szűrők

See the Hungarian translation below (A magyar fordítás lentebb)

Many times we need special filters on our orders for example. Our special requests are in connection with dates very often. Using of "relative date filters" is also possible in AX.
SYSQueryRangeUtil class is our best friend in this case. Don't panic! No programming knowledge we need. The using of these filters is very easy for all type of users.

Start with an easy example
.../Sales and marketing/Inquiries/Order status/Open sales order lines
Type Ctrl+G on the form for grid filtering and use one of these famous methods to see our delayed open orders where the ship date is not older than 200 days.


We can operate with day, month and year ranges as well. An other example: Open orders to be delivered today.


These relative date filters could be very useful for automated reports as well. You can send the selected report for the responsible people in batch job every morning by mail - Eg. 
../Sales and marketing/Reports/Sales orders/Open sales order lines per ship date
Very very very old (from the last year) open sales order lines reported by mail every morning



My favorite methods from this class

Gets the current company Id.
Finds contract person who is associated with the current user.
Finds the customer account that is associated with the current user.
Retrieves the current date as a String.
Retrieves the session date that can be used in queries.
Retrieves the session date and time that can be used in queries.
Finds the current user.
Gets the language of the current user.
Finds the vendor account that is associated with the current user.
Finds the worker that is associated with the current user.
Creates a query string that represents a date range.
Create a date query string that is relative to the session date.
Creates a query string that represents a date range that is based on days.
Creates a query string for all dates that are after the specified date.
Creates a query string that represents a range of dates that uses months.
Creates a query string that represents a date range that uses years.


Total list of the usable methods:
https://msdn.microsoft.com/en-us/library/sysqueryrangeutil.aspx

----

Nagyon sokszor speciális szűrőkre van szükségünk... például a rendeléseink lekérdezéséhez . Ezek a különleges kérések nagyon gyakran a dátumokkal kapcsolatosak. Relatív dátum szűrőket tudunk használni az AX-ben is.
Legjobb barátunk a SYSQueryRangeUtil nevezetű osztály ezekhez az esetekhez. Nem kell izgulni! Nincs szükség fejlesztői tudásra. A szűrők használata nagyon egyszerű minden felhasználó számára.

Egyszerű példa
.../Sales and marketing/Inquiries/Order status/Open sales order lines
Gépeljünk Ctrl+G a formon a "grid"-es szűréshez és használjuk a következő metódust (függvény) a 200 napnál nem régebbi szállítási dátumú elkésett nyitott rendeléseink megjelenítéséhez.

Napi, havi és év intervallumokat is használhatunk. Egy másik példa a ma kiszállítandó nyitott rendelésekhez.

Ezek a relatív szűrők nagyon hasznosak lehetnek automatizált riportoknál. A kiválasztott riport levélben elküldhető minden reggel a felelős személynek.  - Példa 
../Sales and marketing/Reports/Sales orders/Open sales order lines per ship date
nagyon nagyon nagyon régi nyitot rendelések  a tavalyi évből