Focal Point
[SOLVED] Help! Routine to dump data from focus, store in flat file.

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

September 21, 2016, 04:04 PM
Tomsweb
[SOLVED] Help! Routine to dump data from focus, store in flat file.
Trying to create a routine that will dump all of the data from a database and store it in file. This is a flat file, and I want the data to be stored in text format.

I've been testing it and it does not seem to work. Can anyone suggest what might be wrong with it?

 
FILEDEF CR3NTS DISK K:\CR3NTS.txt
-RUN

TABLE FILE WXYZDOGS
PRINT *

ON TABLE SAVE AS CR3NTS FORMAT ALPHA
ON TABLE SET PAGE NOPAGE
END
-RUN

SET HTMLFORMTYPE=TXT

-HTMLFORM BEGIN
!IBI.FIL.CR3NTS;
-HTMLFORM END

-RUN
-EXIT

This message has been edited. Last edited by: Tomsweb,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
September 21, 2016, 04:52 PM
David Briars
!IBI.FIL might not be a bad way to check the file contents, unless the records are very long, and you are blowing through some max length for -HTMLFORM.

Did you go to the K: and try opening the file in Notepad?
September 22, 2016, 04:18 AM
Wep5622
Just as a sanity check; is K:\CR3NTS.txt a path on the server?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 22, 2016, 07:48 AM
Danny-SRL
Tom,
What doesn't work?
No records?
Also, what type of file is WXYZDOGS?
Also, ON TABLE SAVE does not need FORMAT ALPHA: SAVE always produces alpha.
How about adding SET MSG=ON before your TABLE request to see how many records were extracted?
Lastly, if you are using PRINT * to dump your data into a flat file, I would suggest you use TABLEF.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

September 22, 2016, 09:12 AM
Francis Mariani
I didn't expect it to, but this works, it displays the saved file in an HTML page:

TABLE FILE CAR
PRINT
*
ON TABLE SAVE AS CR3NTS FORMAT ALPHA
END
-RUN

SET HTMLFORMTYPE=TXT
-RUN

-HTMLFORM BEGIN
!IBI.FIL.CR3NTS;
-HTMLFORM END



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
September 22, 2016, 02:36 PM
Tomsweb
quote:
[solved] Originally posted by Tomsweb:
Trying to create a routine that will dump all of the data from a database and store it in file. This is a flat file, and I want the data to be stored in text format.

I've been testing it and it does not seem to work. Can anyone suggest what might be wrong with it?

 
FILEDEF CR3NTS DISK K:\CR3NTS.txt
-RUN

TABLE FILE WXYZDOGS
PRINT *

ON TABLE SAVE AS CR3NTS FORMAT ALPHA
ON TABLE SET PAGE NOPAGE
END
-RUN

SET HTMLFORMTYPE=TXT

-HTMLFORM BEGIN
!IBI.FIL.CR3NTS;
-HTMLFORM END

-RUN
-EXIT



Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36