Focal Point
Date formatting

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2691057192

July 16, 2008, 11:55 AM
Jason K.
Date formatting
I have a fex that is returning the following error:

(FOC36346) INCORRECT USE OF DATE-TIME FIELD OR CONSTANT


Here's my fex...
-SET &Y6MO = DATECVT((DATEADD((DATECVT(&YYMD,'I8YYMD','YYMD')), 'D', -183)), 'YYMD','HYYMDI');
TABLE FILE JOBDATA
SUM
CNT.DST.BIDID AS 'COUNT,DISTINCT,BIDID'
BY CLIENTID
WHERE BIDOUT GE &Y6MO;


Here's an excerpt from the jobdata master file.
FIELDNAME=BIDOUT, ALIAS=bidout, USAGE=HYYMDI, ACTUAL=HYYMDI,
MISSING=ON, $

I figured a DATECVT to HYYMDI would make it compatible with the BIDOUT field of the same type.

Any ideas?


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
July 16, 2008, 03:47 PM
jimster06
The following comes to mind:

....date-time literals in the form DT (date-time literal).

eg WHERE TRANSDATE GT DT(2000/01/01 02:57:25)

This may help.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
July 16, 2008, 03:50 PM
GinnyJakes
If you -TYPE your &Y6MO variable, you will see that it is not a datetime stamp. If you just need the time to be zeroes, you can set up the amper variable so that it is just a date and then concatenate the time to it and use the second variable in your WHERE clause.

Something like this:
-SET &Y6MO = AYMD(&YYMD,-183,'I8YYMD');
-TYPE &Y6MO
-SET &Y6MODT=&Y6MO | ' 00:00:00.0000';
-TYPE &Y6MODT



Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
July 21, 2008, 06:56 PM
njsden
You may probably want to use a combination of the techniques provided by both jimster06 and GinnyJakes. I just did and it help me to solve a query problem I was having when trying to retrieve information from Oracle table:

-* Any date to be processed
-DEFAULT &MYSTARTDT=20080701;

-* Go 6 months back (or something like that) and set value as date/time
-SET &MYSTARTDTTM=EDIT(DATECVT(DATEADD(DATECVT(&MYSTARTDT,'I8YYMD','YYMD'), 'D', -183), 'YYMD','A8YYM'), '9999/99/99') | ' 00:00:00';
-TYPE &MYSTARTDTTM

-* Retrieve from DB
TABLE FILE ...
PRINT ...
WHERE DTTM_IN_TABLE GE DT(&VACTSTARTDT);
END




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.