Focal Point
Defining a Date Field for a DBF output.

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

May 12, 2010, 01:31 PM
<José Andrés Vargas Aguilar>
Defining a Date Field for a DBF output.
Hy, I need to PRINT a date field on a DBF file.

I've tried with the following code's and functions and neither of them works:

-* FECHA/DMYY=HDATE(FECH,'DMYY');
-* FECHA/DMYY=HDATE(FECH,'D|M|YY');
-* FECHA/DMYY='&wf_fchref';
-* FECHA/HYYMDS = HDTTM(FECH,8,'HYYMDS');
-* FECHA/A8 = FECH;
-* FECHA/I8 MISSING ON NEEDS ALL = HPART(FECH,'DATE','I8');
-* FECHA/HYYMDS = DT(FECH);

... Being FECH the date field retrieved from my ORACLE PL/SQL query and FECHA the name of the field I'll print to the DBF file. Al that code has been tested (obviusly without the -* ) on a DEFINE and then using PRINT on my DBF.

When I open the DBF on MS Access I get a Numeric field on the DBF on most of the cases and on some of them I get an error data type.

The date can also be read on the &wf_fchref string parameter, it's a constant value on the fex.

So, can anyone tell me how to print the date from FECH or &wf_fchref into the DBF please?

Thanks!

This message has been edited. Last edited by: <José Andrés Vargas Aguilar>,
May 12, 2010, 01:43 PM
Francis Mariani
-SET &WF_FCHREF = &YYMD;

DEFINE FILE CAR
DTTM1/HYYMDS = DT(&WF_FCHREF 00:00:00.000);
DTTM2/A20 = HCNVRT(DTTM1, '(H17)', 17, 'A20');
DTTM3/A20 = HCNVRT(DTTM1, '(HYYMDS)', 20, 'A20');

END

TABLE FILE CAR
PRINT 
DTTM1 
DTTM2
DTTM3
BY COUNTRY
END


Result:

 PAGE     1
 
 
 COUNTRY     DTTM1                DTTM2                 DTTM3
 -------     -----                -----                 -----
 CANADA      2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00
 ENGLAND     2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00
 FRANCE      2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00
 ITALY       2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00
 JAPAN       2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00
 W GERMANY   2010/05/12 00:00:00  20100512000000000     2010/05/12 00:00:00

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 12, 2010, 04:47 PM
<José Andrés Vargas Aguilar>
Francis thanks.

Maybe I wasn't clear enough. &wf_fchref isn't today's date. It's a string that my report gets when getting called and that represents the date I use to retrieve data on a SQL.

On the DBF It must be "PRINTED" as a Date. The code you gave prints a Text. This is the adaptation of your code:
   

-DEFAULT &wf_fchref  = '05-01-2010';

-SET FECFILE = 'testing' ;
-SET FECFILEO= 'testing' | '.DBF';

-SET papp = 'cachebw';
-SET pdire = &APPROOT;

DEFINE FILE CAR
DTTM1/HYYMDS = DT(&wf_fchref 00:00:00.000);
BTN/A500='Download file here: <a href=''/approot/&papp/&FECFILE''>&FECFILE</a>';
END

TABLE FILE CAR
PRINT
DTTM1 AS 'DATE'
COUNTRY

ON TABLE HOLD AS &FECFILE FORMAT DBASE
END

-RUN

-TYPE &FECFILEO
-TYPE &FECFILE

-SET &pfdele = &pdire | '\' | &papp | '\' | &FECFILEO;
-SET &pfcopy = &pdire | '\' | &papp | '\' | &FECFILE;

-TYPE Archivo a Borrar &pfdele
-TYPE Archivo a Copiar &pfcopy

-WINNT DEL &pfcopy
-WINNT COPY &pfdele &pfcopy

TABLE FILE CAR
PRINT
DTTM1 AS 'DATE'
COUNTRY

HEADING
"<BTN"

END


May 12, 2010, 05:23 PM
Francis Mariani
My code is an example.

There's not much difference between
-SET &WF_FCHREF = &YYMD;
and
-DEFAULT &wf_fchref  = '05-01-2010';
- I am just setting a Dialogue Manager string.

"On the DBF It must be "PRINTED" as a Date" - Perhaps WebFOCUS cannot create a Date-Time field for DBF or DBASE. None of my attempts below produce a Date column in MS Access.

-DEFAULT &WF_FCHREF  = '05-01-2010';

-SET &WF_FCHREF1 = EDIT(&WF_FCHREF,'99$99$9999');

-SET FECFILE = 'TESTING' ;

APP HOLDDATA TEST
-RUN

DEFINE FILE CAR
DTTM1/HYYMDS = DT(&WF_FCHREF 00:00:00.000);
DTTM2/A20 = HCNVRT(DTTM1, '(H17)', 17, 'A20');
DTTM3/A20 = HCNVRT(DTTM1, '(HYYMDS)', 20, 'A20');
DT1/DMYY = DATECVT(&WF_FCHREF1, 'I8DMYY', 'DMYY');
DT2/A10 = EDIT('&WF_FCHREF1','99/99/9999');
DT3/A8DMYY = EDIT('&WF_FCHREF1','99999999');

END

TABLE FILE CAR
PRINT
DTTM1
DTTM2
DTTM3
DT1
DT2
DT3
COUNTRY

ON TABLE HOLD AS &FECFILE FORMAT DBASE
END
-RUN



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 12, 2010, 05:29 PM
Francis Mariani
DT1 in this example seems to generate a Date field in MS Access:

-SET &ECHO=ALL;

-DEFAULT &WF_FCHREF  = '05-01-2010';

-SET &WF_FCHREF1 = EDIT(&WF_FCHREF,'99$99$9999');

-SET FECFILE = 'TESTING' ;

APP HOLDDATA TEST
-RUN

DEFINE FILE CAR
DTTM1/HYYMDS = DT(&WF_FCHREF 00:00:00.000);
DTTM2/A20 = HCNVRT(DTTM1, '(H17)', 17, 'A20');
DTTM3/A20 = HCNVRT(DTTM1, '(HYYMDS)', 20, 'A20');
DT1/YYMD = DATECVT(&WF_FCHREF1, 'I8DMYY', 'YYMD');
DT2/A10 = EDIT('&WF_FCHREF1','99/99/9999');
DT3/A8DMYY = EDIT('&WF_FCHREF1','99999999');

END

TABLE FILE CAR
PRINT
DTTM1
DTTM2
DTTM3
DT1
DT2
DT3
COUNTRY

ON TABLE HOLD AS &FECFILE FORMAT DBASE
END
-RUN



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 13, 2010, 10:02 AM
<José Andrés Vargas Aguilar>
This last one did it Francis, thanks!