× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I do quite a large number of queries where the date that the query is run is factored into the selection criteria. For example, here are the specs for one that lists customer order details whose ship dates have been missed. The data is BPCS whose internal date is in the numerical format YYYYMMDD in which sometimes there are invalid calendar dates in there, like 99999999 and 00000000 have special meanings to the software.

I hope the following specifics help you with your current needs.

First I get a value that is the date that the query was run, in a format that supports query date math.

TODAY CURRENT(DATE) Day Query Done mm/dd/yy Date Math ISO

Then I convert the date, that the shipment was supposed to be made, into the same format. Hopefully this makes sense to you, but if not, we can talk more.

DA DIGITS(LRDTE) Day Due alpha convert Date Math ISO

DN DATE(SUBSTR(DA,5,2)||'/'|| Day Due SUBSTR(DA,7,2)||'/'|| ISO SUBSTR(DA,3,2)) Date Math

Then I subtract the converted date, when the shipment was due, from the day the query was run, to get how many days ago we are past due on this.

DAYS_AGO DAYS(TODAY) - DAYS(DN) Days Past
                                                Due

The selection criteria in this example is for a customer service person who has a small number of customers he manages relations with, and needs to see which of them are now past due. DAYS_AGO equal ZERO are those that should have gone out TODAY.

LCUST LIST 4685 6315 6316 6410 7530 5865 6415 6185 3644 2565 6184 6355 4545 7700 11120 AND LICFAC LIST '20' '60' AND LEFT GT 0 AND DAYS_AGO GE 0

LEFT is another calculation to get quantity left to ship.

Good Morning,

I am setting up a query and was wonder if I could define a field with
the system date?

-
Al Macintyre  http://www.ryze.com/go/Al9Mac
BPCS/400 Computer Janitor ... see
http://radio.weblogs.com/0107846/stories/2002/11/08/bpcsDocSources.html

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.