Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     need help for footer in csv output format [SOLVED]

Read-Only Read-Only Topic
Go
Search
Notify
Tools
need help for footer in csv output format [SOLVED]
 Login/Join
 
Gold member
posted
Hi All,

I have a requirement in which the output needs to be csv ( the file will be fed to another system as a feed file). The users want header and a footer with the number of records in it.
I have gone through other topics in the forum and saw the threads.

In this case, the csv file needs to be saved and when I save it, the footer and header disappear.

The following is my code:

FILEDEF testfile DISK testfile.CSV (APPEND
-RUN

-WRITE testfile Country,Car,Model,Rcost,Dcost

TABLE FILE CAR
PRINT
RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
ON TABLE PCHOLD AS testfile FORMAT COMMA
END
-RUN
-WRITE testfile There are &LINES Records in this file
CMD TYPE testfile.csv

Thanks for reading.

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


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
Switch your hold format to COMT. That keeps the column headings in the output. I believe you should also switch from PCHOLD to HOLD.

ON TABLE HOLD AS testfile FORMAT COMT

If you want to keep your FILEDEF APPEND with your own titles, just switch from PCHOLD to HOLD and your code will work.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Gold member
posted Hide Post
Thanks BabakNYC for the suggestion.
I need the file saved on a physical directory, and the issue arises when I save it.
As soon as I open the saved file, it loses all its headers and footers.


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
Switch from PCHOLD to HOLD. I just tested your code with HOLD and it works.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Gold member
posted Hide Post
When I switch from PCHOLD to HOLD, the output is displayed on the screen.
I need the output to be saved on my machine, as another system needs this file as input.

Am I missing something?


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Virtuoso
posted Hide Post
I just tested this in 8105 and got a csv file on my E: drive. It also displays on my screen because of CMD TYPE E:\testfile.csv.
FILEDEF testfile DISK E:\testfile.CSV (APPEND
-RUN

-WRITE testfile Country,Car,Model,Rcost,Dcost

TABLE FILE CAR
PRINT
RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS testfile FORMAT COMMA
END
-RUN
-WRITE testfile There are &LINES Records in this file
CMD TYPE E:\testfile.csv


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Expert
posted Hide Post
The WF Reporting server has no idea where "YOUR" machine is. We FILEDEF with an address of:
d:\ibi\apps\hold_area_for_files\

Your IBI install may be on a different drive.

If you APPEND right off the bat, the next time its run will retain the data from the previous run.

Store the file on the server, or, on a NFS drive, then FTP/EMAIL.

  
FILEDEF testfile DISK d:/ibi/apps/baseapp/testfile.csv  
-RUN

-WRITE testfile Country,Car,Model,Rcost,Dcost

FILEDEF testfile DISK d:/ibi/apps/baseapp/testfile.csv (APPEND
-RUN

TABLE FILE CAR
PRINT
RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS testfile FORMAT COMMA
END
-RUN
FILEDEF testfile DISK d:/ibi/apps/baseapp/testfile.csv (APPEND
-RUN

-WRITE testfile There are &LINES Records in this file
-CLOSE testfile
-EXIT


EDIT: Didn't have the FILEDEF coded correctly, works now...

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Thanks a lot Tom and babakNYC for your inputs.
I understood that the web focus server has no idea of my machine.
So I created a temporary folder in my C:\ibi\apps\testing and tried to run the procedure.

I get (FOC340) DIALOGUE MANAGER -WRITE FILE NOT ALLOCATED OR FILEDEF'ED

Is it related to permissions?
I have not used filedef earlier and hence the trouble...


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Expert
posted Hide Post
Use the example I gave above; I had mis-coded some things. the above example now works.


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Thanks Tom for correcting your code.
I tried it and still get (FOC340) DIALOGUE MANAGER -WRITE FILE NOT ALLOCATED OR FILEDEF'ED .

From the message I understand that the path I am giving c:/ibi/apps/testfile.csv is not the right path for writing the testfile.


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
Expert
posted Hide Post
At the top of the FEX, do
? PATH
-EXIT

This will tell you the DRIVE:\Folder\Structure of your IBI install...

Code accordingly...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
Thanks Tom for your help on this.
I have a shared location which is mapped and was able to send the test file there.


WebFOCUS 7.7.02Windows
Output Formats: Excel, HTML, PDF
 
Posts: 82 | Registered: February 23, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     need help for footer in csv output format [SOLVED]

Copyright © 1996-2020 Information Builders