Thank you Emmitt,

 

I forgot that it is considered non-standard.  I to have used it so many
times that I also hope it never changes.  That would be a work out.  Also
adding it to a "Stored Procedure" would only make since for me.  I am going
to use it a lot.  

 

So, Thank you again for BOTH suggestions.

 

Sincerely,

Paul D

 

Non-standard - -   Me?   <g> 

 

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Emmitt Dove
Sent: Monday, August 17, 2009 1:35 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: SSub Declare date var

 

Paul,

 

The reason that

 

Set Var v2 date = (ssub(.vLFNFileDT1,-1))  

 

fails is that you cannot assign the results of an expression which evaluates
to a TEXT datatype to a DATE datatype.  The two-step approach works because
R:BASE lets you create a DATE variable by assigning a text value without the
use of a function call.  Honestly, that is non-standard.  Use it all the
time; love it; wouldn't ever want to see it changed.  But non-standard.  It
is really an implied function call:

 

SET VAR v2 DATE = (ConvertToDate(SSUB(.vLFNFileDT1,-1))) 

 

Now, you *could* write your own function (stored procedure) ConvertToDate
that does nothing but create a date variable from a text input . or you can
use a long string of nested functions to get to your result in one step.

 

R>SET VAR vresult TEXT =
(CTXT(IYR4(.#DATE))+SGET(FORMAT(IMON(.#DATE),'00'),2,2)+SGET(FORMAT(IDAY(.#D
ATE),'00'),2,2))

 

R>SHO VAR

Variable           = Value                                   Type

------------------   ------------------------------          --------

#DATE              = 08/17/2009                               DATE    

#TIME              = 13:34:19                                 TIME    

#PI                = 3.14159265358979                         DOUBLE  

SQLCODE            = 0                                        INTEGER 

SQLSTATE           = 00000                                    TEXT    

#NOW               = 08/17/2009 13:34:19                      DATETIME

vresult            = 20090817                                 TEXT   

 

You can take the above and, in the same step, tack on whatever else you want
for filename . or expand it to include the time in the string, or both.

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

Reply via email to