using DATE types and operators in Blaise

2 posts / 0 new
Last post
ry1633
using DATE types and operators in Blaise

Hi all,

Can someone walk me through the use of DATE types and operators. I've been reading through them in the Help and Dev Guides but I'm still a little confused. I'd like to used them in data output and reporting in Manipula.

If I setup a Date type how can I set it equal to today's date? This is what the manual says but I don't understand its usage.

Today:= YesterDay + (0,0,1)
LastYear:= Today - (1,0,0)

Here's an example of a Manipula report program that I'm running. I'd like to set the DATE equal to today's date in the CRData datamodel, but I don't know how.

-------

SETTINGS
ACCESS=SHARED
ONLOCK=CONTINUE
AUTOREAD=YES

USES
CRResidents1 'H:\BlaiseData\ComRes\Practice\CRResidents1'
DATAMODEL CRData
FIELDS
CaseID : STRING[5]
IntID : STRING[2]
CompStatus : 0..9
Date : DATETYPE
ENDMODEL

INPUTFILE
InFile1 : CRResidents1 ('H:\BlaiseData\ComRes\Practice\CRResidents1', BLAISE)
{FILTER
CaseID
Ident
Manage
TimeStamp
IntID }

OUTPUTFILE
OutFile1 : CRData ('H:\BlaiseData\ComRes\Reports\CRRReport.csv', ASCII)
SETTINGS
HEADERLINE = YES
MAKENEWFILE = NO
SEPARATOR = ','

MANIPULATE
OutFile1.CaseID := InFile1.CaseID
OutFile1.CompStatus := InFile1.CompStatus
{OutFile1.TimeStamp := InFile1.TimeStamp}
OutFile1.Date := InFile1.Date
OutFile1.IntID := InFile1.IntID

IF InFile1.CompStatus = 4 AND Date = Today THEN
OutFile1.WRITE
ENDIF
{

fwensing
fwensing's picture
Some date information

Ryan

The simplest way to set a value to today's date is to use the SYSDATE function. For example, in Manipula

AUXFIELDS
    Today : DATETYPE

MANIPULATE
    Today := SYSDATE

This also works in the RULES of a Blaise datamodel. There is also a function called SYSTIME which returns the current clock time.

If you want to assign a specific date (other than today) you can use the TODATE function. The syntax is

TODATE (Y, M, D)

where Y, M and D are year, month and day. For example

AUXFIELDS
    YearStart : DATETYPE

MANIPULATE
    YearStart := TODATE(2009,1,1)

Note that the keyword TODATE is optional on the right hand side of the above expression but I would use it anyway for documentary completeness. Once again you can use this function in the RULES of a Blaise datamodel too. There is also a TOTIME function which works in a similar way:

TOTIME (H, M, S)

The other date functions you can use are DATETOSTR and STRTODATE. I notice that you have already found them.

Good luck

Fred :cool:
PS. I would have answered earlier but I have not been receiving notifications of postings. I am catching up.

Log in or register to post comments