[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: dateadd problem



With release 4 they introduced a 'date' type.  Define "$chart_for_date" as a
date and I think the function will probably work OK.  Good luck.

Thanks,
Alan Lane
ajlane@carolina.rr.com
(704) 543-7270 or (704) 516-4463
www.AJLaneInc.com
FAX: (877) 877-4878 ext 3540 [follow verbal prompts]

-----Original Message-----
From: Discussion of SQR, Brio Technology's database reporting language
[mailto:SQR-USERS@list.iex.net]On Behalf Of Bob Helm
Sent: Thursday, April 05, 2001 10:45 AM
To: SQR-USERS@list.iex.net
Subject: dateadd problem


I have a problem that should be easy to fix, but I'm stuck.

I simply want to add 2 months to a date. My code is as follows:

let $run_day = edit(Datenow(),'DD')
    if $run_day != '05'
        let $chart_for_date = dateadd(datenow(),'month',1)
        print $chart_for_date (+1,1)  edit 'Month YYYY'
    else
        let $chart_for_date = Datenow()
        print $chart_for_date (+1,1)  edit 'Month YYYY'
    end-if

    let $chart_thru_date = dateadd($chart_for_date,'month',2)
    print $chart_thru_date  (+1,1)

When I try to run I get the following error message:

Error on line 282:
   (SQR 4045) Function or operator 'dateadd' requires date argument.

As you can see, if I use Datenow() for the date value, it works. Otherwise,
I get the error
and am having to write unnecessary lines of code.


Thanks a ton,

B
The Programmer formally known as Bob
Mediware Information Systems Inc.
(913) 307-1045
Bob.Helm@Mediware.com