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

Re: Date comparisons



Title: RE: Date comparisons

Hi Julie,

Unfortunately for you, SQR v3 doesn't have the date variables and functions that SQR 4 has.  However, you could use database commands inside a SELECT or SQL paragraph (BEGIN-SELECT / BEGIN-SQL) to return a value that you could act on.

For instance, in SQL Server you could code...

BEGIN-SELECT
DATEDIFF(d,'1/31/00','1/24/00') &DIFF
        move &DIFF to #Diff
END-SELECT

which would return #Diff as -7.

HTH
Bob

-----Original Message-----
From: Julie Lawton [mailto:lawton_julie@HOTMAIL.COM]
Sent: Tuesday, March 07, 2000 10:34 AM
To: SQR-USERS@list.iex.net
Subject: Date comparisons


Hi,

My application runs its report scripts using the "ngtsqr" utility which is a
standard SQR engine re-linked with the application's specific libraries.
The version of SQR which is uses is v3.0.7.0.1.  It is provided by the
vendor of the application.  Therefore, I am not able to control which
version I use.

I have a sqr file which generates flat files.  To determine what data to
place in one of the fields, I am using if statements.  Here is an extract of
the code:

begin-select
SystemModificationDateTime      &SystemModificationDateTime
SystemCreationDateTime          &SystemCreationDateTime
TradeStatus
        let #status = &TradeStatus
        let #created = &SystemCreationDateTime
        let #modified = &SystemModificationDateTime
        if #status = 1 and &SystemCreationDateTime=
&SystemModificationDateTime
        print 'I' ()
        else
                if #status = 1 and &SystemModificationDateTime >
&SystemCreationDateTime
                print 'A' ()
                else
                        if #status = 4
                        print 'D' ()
                        end-if
                end-if
        end-if
        print ',' ()
OriginalTradeCode               (,,)
...

Basically, I am trying to determine the status of the trade i.e. insert (I),
amend (A) or delete (D).  Where I have Insert and Deletions, the file is
created with the appropriate flag i.e. I or D.  However for the amend case,
I get no flag (no A).

I don't think I can do a comparison of the dates where one is greater than
the other.  However, I cannot use datediff either. I get the following error
message so I guess that datediff was not available in this version:

Error on line 39:
   (SQR 4008) Unknown function or variable in expression: datediff
let #diff = datediff(&SystemModificationDateTime, &SystemCreationDateTime,
'second')

Any suggestions on how I can compare the two dates to determine whether one
is greater than the other.

In this case, I could use where &SystemModificationDateTime !=
&SystemCreationDateTime

but further on in my code, I need to determine which date to use so I need
to know which is the latest.

I appreciate any help which you may be able to offer.

Thanks

Julie

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com