1

Today keyword gives me today's date, but how can add one (or more) days so I can compare it? I've tried the following code.

FOR EACH foo
    where date(today) +1 > end_date
NO-LOCK

The error I get is "PREPARE syntax is {FOR|PRESELECT} EACH..."

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
Baked Inhalf
  • 3,375
  • 1
  • 31
  • 45
  • 1
    The problem is "+1". The lack of a space between "+" and "1" means that it is a signed constant rather than the addition of one day to today. – Tom Bascom Jan 16 '17 at 14:28
  • Yes I accidently figured that out when I tried a few combinations. Was thinking I needed to convert to integers first but it worked with just `TODAY + 1` – Baked Inhalf Jan 16 '17 at 14:41
  • As a suggestion, when working with dynamic queries, find a way to display the resulting query to a file or the screen. Grab the query and run it from the editor. It should always work. Can't count the times this (can I call it so?) trick has helped me debug programs. – bupereira Jan 16 '17 at 15:28

1 Answers1

4

Just TODAY + 1 - I guess you have a problem in the rest of your dynamic query statement(s):

hQuery:QUERY-PREPARE (SUBSTITUTE ("FOR EACH foo WHERE end_date < &1", QUOTER (TODAY + 1))) .

Mike Fechner
  • 6,627
  • 15
  • 17