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     [SOLVED] Total Records in CSV

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Total Records in CSV
 Login/Join
 
Gold member
posted
HI,

I need the total no of recors to be displayed in csv.Using footing and headings doesn ot work. Is there any other way to bring header and total no of records (at the bottom).

Thanks!

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


WebFOCUS 7.6.9
Windows
Excel, HTML, PDF
 
Posts: 71 | Registered: April 17, 2009Report This Post
Expert
posted Hide Post
You want header and footer records in a CSV file? Then your answer may lay in filedefing your output file ahead of the report in APPEND mode, then write your header to the file, run the report into the file followed by writing the footer.

To obtain record counts to go into the header, you would need to preprocess the data to obtain the system variable for the number of records.

If you know WebFOCUS and dialogue manager then this should be easy.

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, 2004Report This Post
<JG>
posted
Don't need the preprocess step

Create the CSV as COM not COMT
Put the value of &RECORDS into an other variable
Filedef the generated file using (APPEND
-WRITE the extra data required

e.g.
TABLE FILE blablabla
PRINT col1 col2 col3 etc.
ON TABLE HOLD FORMAT COM
END
-RUN
-SET &CSVROWS = &RECORDS;
FILEDEF HOLD DISK HOLD.CSV (APPEND
-RUN
-WRITE HOLD "col1","col2","col3",'etc."
-WRITE HOLD RECORDS= &CSVROWS

Or whatever information is required by the application you are creating the file for.
 
Report This Post
Expert
posted Hide Post
JG, Preprocess only for a heading if required, as in -

To obtain record counts to go into the header, you would need to preprocess the data to obtain the system variable for the number of records.

Otherwise exactly as I suggested? The sun must be getting to you Wink

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, 2004Report This Post
<JG>
posted
quote:
(at the bottom).

Tony, That's what I was aiming at.

Not as much sun here as where you are at the moment.
 
Report This Post
Expert
posted Hide Post
Even more sun where I'm going Smiler

T
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
HI,

Thanks for the suggestions. I tried the bewlo code :

  
TABLE FILE CAR
PRINT 
COUNTRY
CAR
ON TABLE HOLD AS HLD1 
END

TABLE FILE HLD1
PRINT
*
ON TABLE PCHOLD FORMAT COM
END
-RUN
-SET &CSVROWS = &RECORDS;
FILEDEF HOLD DISK HLD1.CSV (APPEND
-RUN
-WRITE HOLD "COUNTRY","CAR"
-WRITE HOLD RECORDS= &CSVROWS


When i try the above code , i get the output as


ENGLAND","JAGUAR" "ENGLAND","JENSEN" "ENGLAND","TRIUMPH" "JAPAN","DATSUN" "JAPAN","TOYOTA" "ITALY","ALFA ROMEO" "ITALY","MASERATI" "W GERMANY","AUDI" "W GERMANY","BMW" "FRANCE","PEUGEOT"

I do not find the total records geeting appended.Am i doing something wrong?

Thanks!


WebFOCUS 7.6.9
Windows
Excel, HTML, PDF
 
Posts: 71 | Registered: April 17, 2009Report This Post
Expert
posted Hide Post
The item you are getting wrong is not understanding the difference between PCHOLD and HOLD. Reread JG's post, go look at a manual or read other recent posts about it to understand. Then apply what you learn.

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, 2004Report This Post
Gold member
posted Hide Post
Hi,

Sorry it was just a syntax mistake . I did exactly as what JG had said. I did not get the total no of records appended.

Thanks!


WebFOCUS 7.6.9
Windows
Excel, HTML, PDF
 
Posts: 71 | Registered: April 17, 2009Report This Post
<JG>
posted
quote:
ON TABLE PCHOLD FORMAT COM
END
-RUN
-SET &CSVROWS = &RECORDS;
FILEDEF HOLD DISK HLD1.CSV (APPEND

should be

ON TABLE HOLD FORMAT COM
END
-RUN
-SET &CSVROWS = &RECORDS;
FILEDEF HOLD DISK HOLD.CSV (APPEND
 
Report This Post
Expert
posted Hide Post
May I suggest you use &LINES and not &RECORDS to determine the number of lines in the hold file? &RECORDS is a count of the number of rows read and not the number of rows in the output. With a PRINT there is no difference between &RECORDS and &LINES, but with a SUM there is.

FILEDEF HLD1 DISK HLD1.CSV (APPEND
-RUN

-WRITE HLD1 "COUNTRY","CAR"

TABLE FILE CAR
PRINT 
COUNTRY
CAR
ON TABLE HOLD AS HLD1 FORMAT COM
END
-RUN

-SET &CSVROWS = &LINES;

-WRITE HLD1 RECORDS= &CSVROWS


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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     [SOLVED] Total Records in CSV

Copyright © 1996-2020 Information Builders