[SOLVED] Converting SQL datetime field for use with DOWK.
I've read everything I can find - and I can't seem to make this work. The original table is MS SQL. The master was generated with datetime off and the usage was set to YYMD. Now I want to use dowk on that field - but it fails if used directly on that field because it is not "really" a YYMD field. I've tried to convert it - but that is the part I can't seem to get right.
This is the field in the master: FIELDNAME=TEST_DATE, ALIAS='Test Date', USAGE=YYMD, ACTUAL=DATE, FIELDTYPE=R,
This is what I have tried for converting it: DAY2/YYMD=DATECVT(TEST_DATE, 'HYYMDs', 'YYMD'); DAY3/A3=DOWK(DAY2, 'A3'); DAY4/I2=DECODE DAY3( 'SUN' 1 'MON' 2 'TUE' 3 'WED' 4 'THU' 5 'FRI' 6 'SAT' 7);This message has been edited. Last edited by: cbrady,
prod: WF 8.1 On Win2012 database: msSQL2012 test: identical to prod
June 25, 2010, 05:24 PM
FrankDutch
Is it in the database available as HYYMDs?
Frank
prod: WF 7.6.10 platform Windows, databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7 test: WF 7.6.10 on the same platform and databases,IE7
June 25, 2010, 05:41 PM
cbrady
In the SQL table it is a standard SQL datetime field. I generated the master with datetime off.
prod: WF 8.1 On Win2012 database: msSQL2012 test: identical to prod
June 25, 2010, 05:51 PM
cbrady
If I do this: DAY3/A3=DOWK(TEST_DATE, 'A3');
I get this error: (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DOWKI
prod: WF 8.1 On Win2012 database: msSQL2012 test: identical to prod
June 25, 2010, 06:42 PM
Dan Satchell
You might give functions HNAME or HPART a try. They can be used to extract day of week (dw) from datetime data. Also, function HDATE is an easier way to convert datetime fields to Smart Dates.This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
June 26, 2010, 11:28 AM
cbrady
Hi Dan,
Appreciate the help - but that does not work either.
If I had generated it with datetime on - the field in the master file would have been defined as 'HYYMDs' - but I generated it with datetime off. If I try to use it in any field that does require a time compnonent (HDATE,HPART, etc) it behaves as if it is a YYMD (and fails as YYMD is not a datetime format). If I try to use it with DOWK, which require a YYMD format - it behaves as if it is NOT a YYMD field.
This: DDATE/YYMD=HDATE(TEST_DATE, 'YYMD');
Results: (FOC36355) INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION HDATE
prod: WF 8.1 On Win2012 database: msSQL2012 test: identical to prod