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.
Header and footer are not meant for csv output. There also is no styling available for a csv file. The only thing you can do with this format is to add the column titles (format comt iso com). But if you really need some header and/or footer (usually this is the case when you need a start and/or end-record) you can do this with os commands. For instance, if you need a header record that states how many records there will be in the file, you can create a TABLE request that gives the desired output for the header record and save it to disk. Then you can create the body of the file, and save it. Lastly, create a request that will produce the footer record and save it also. Then use the specific os-command for copying multiple files into one. Alternatively, you could use the FILEDEF (APPEND option. That way you don't need the os commands to concatenate the files.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
But if you do that, you would have to construct the record with all comma's in between the fields manually, or place a dummy field with the comma in it between every field in the report. It might be a lot more work to get that right than to simply use a file append.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
OK, thanks guys, anyways i am thinking of taking a header and footer in different hold files and merge them. Can I do that? If yes then please share a little on how that can be achieved.
PS: Is there anyway to remove spaces between columns? I tried using 'SET SPACES' but the minimum is one as it takes integer value only
Thanks SidThis message has been edited. Last edited by: sidney_jec,
SPACES, as you noticed, may be set from 1 to 8. 0 is not an option. Not setting it results in 2 spaces. But why do you think you need to revert to format WP for your header and footer?
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Well i need the header and footer without inverted commas and besides that how will I append the files if i have to send them through report caster. Anyways i have found the solution. I'll just concatenate all the columns in one Define field and use it. If you have a better solution always welcome Thanks Sid
There are many previous discussions that would have given you the solution or led you to it.
All you have to do is filedef the file, write the header, place your output into it, write the footer, move/copy it to your desired location (if you haven't filedef'd it directly), job done -
SET MSG=OFF
FILEDEF sidsfile DISK sidsfile.CSV (APPEND
-RUN
-WRITE sidsfile Country,Car,Model,Rcost,Dcost
TABLE FILE CAR
SUM RCOST
DCOST
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS sidsfile FORMAT COMMA
END
-RUN
-WRITE sidsfile There are &LINES Records in this file
CMD TYPE sidsfile.csv
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Ok thanks man.. anyways one last question.. is there anyway in which I can reduce the left margin to 0.. i mean the text in the HTML should start from the first place itself.. currently its taking 2 spaces by default..
thanks for the encouragement guys anyways.. i tried using FILEDEF but the thing is that i am not able to write into the file though i have all the rights.. i am getting FOC340 error..
i have tried doing it but help's still needed also i'll be distributing it using report caster so will I be able to append the file??
PS: am a little new to this technology.. so might not be as sound as u guys are..
These three examples each create a hold file where the first row of data contains the column names. Format COMT, COM and COMMA are used. My preference is COMT.
-SET &ECHO = 'ALL';
-*-- Create the extract hold file
FILEDEF HCAR2 DISK C:\ibi\apps\baseapp\hcar2.csv
-RUN
TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR2 FORMAT COMT
END
-RUN
-*-- Add footer
FILEDEF HCAR2 DISK C:\ibi\apps\baseapp\hcar2.csv (APPEND
-RUN
-WRITE HCAR2 "END OF FILE"
-SET &ECHO = 'ALL';
TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS H001
END
-RUN
-*-- Create a hold file containing the column names and other attributes of the hold file
CHECK FILE H001 HOLD
-RUN
-*-- Create a hold file containing only the column names generated by the across statement
FILEDEF HCAR1 DISK C:\ibi\apps\baseapp\hcar1.csv
-RUN
?FF HOLD
TABLE FILE HOLD
SUM
FIELDNAME
ACROSS FLDNO NOPRINT
ON TABLE HOLD AS HCAR1 FORMAT COM
END
-RUN
-*-- Create the extract hold file
FILEDEF HCAR1 DISK C:\ibi\apps\baseapp\hcar1.csv (APPEND
-RUN
TABLE FILE H001
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR1 FORMAT COM
END
-RUN
-*-- Add Footer
-WRITE HCAR1 "END OF FILE"
-SET &ECHO = 'ALL';
TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS H001
END
-RUN
-*-- Create a hold file containing the column names and other attributes of the hold file
CHECK FILE H001 HOLD
-RUN
-*-- Create a hold file containing only the column names generated by the across statement
FILEDEF HCAR DISK C:\ibi\apps\baseapp\hcar.csv
-RUN
?FF HOLD
TABLE FILE HOLD
SUM
FIELDNAME
ACROSS FLDNO NOPRINT
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN
-*-- Create the extract hold file
FILEDEF HCAR DISK C:\ibi\apps\baseapp\hcar.csv (APPEND
-RUN
TABLE FILE H001
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN
-*-- Add footer
TABLE FILE CAR
SUM
COMPUTE FOOTER/A15= 'TOTAL SALES:';
SALES
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN
Now, go do your homework
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