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     [CLOSED] Why is getting total records on a report so difficult?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Why is getting total records on a report so difficult?
 Login/Join
 
Gold member
posted
DEFINE FILE SQLOUT
DUMMY/A1 = ' ';
END
TABLE FILE SQLOUT
BY DUMMY NOPRINT
-SET &LicenseNumber = IF &LicenseNumber EQ '' THEN FOC_NONE ELSE &LicenseNumber;
-SET &StartDate = IF &StartDate EQ '' THEN FOC_NONE ELSE &StartDate;
-SET &TaxPeriod = IF &TaxPeriod EQ '' THEN FOC_NONE ELSE &TaxPeriod;
WHERE ( Tax_period EQ '&TaxPeriod');
WHERE ( License_no EQ '&LicenseNumber');
WHERE ( Refund_Date FROM DT(&StartDate) TO DT(&EndDate) );
PRINT
     License_no AS 'License,Number'
     Trade_Name AS 'Trade,Name'
     Legal_Name AS 'Legal,Name'
     Tax_period AS 'Tax,Period'
     Refund_Amount AS 'Refund,Amount'
     Refund_Date/HMDYY AS 'Refund,Date'
     SAP_Transmittal_Number AS 'SAP,Transmittal,Number'
BY DUMMY NOPRINT
ON DUMMY SUBFOOT
"Total Refunds: &LINES "
HEADING
"Refund Report:&DATEMDYY "  



Why is this &LINES not working on the Total refunds line? What am I missing?

All I want to do is count the number of lines on the report. Should be simple so I must be missing something easy.

Thanks a bunch for the help.

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


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Gold member
posted Hide Post
Have you tried getting the number of records FIRST before tring to use &LINES?

I would do the following:
  
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS TEST1
END
-RUN
TABLE FILE TEST1
BY DUMMY NOPRINT
:
:
:
ON DUMMY SUBFOOT
"Total Refunds: &LINES "


WF 7.6.10, Windows, PDF, Excel
 
Posts: 75 | Location: Dallas, TX | Registered: February 12, 2004Report This Post
<JG>
posted
quote:
Why is getting total records on a report so difficult?

Probabley because you are making a fundamental mistake.

&LINES is only available after a -RUN

TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD
END
-RUN
-SET &HOWMANYLINES=&LINES;
TABLE FILE HOLD
" I have this many lines &HOWMANYLINES"
PRINT *
END
 
Report This Post
<FreSte>
posted
... or in 1 go

TABLE FILE CAR
HEADING
"Number of lines: <CNT.MODEL"
COUNT MODEL NOPRINT
SUM
DEALER_COST
BY COUNTRY BY CAR BY MODEL
END
 
Report This Post
Expert
posted Hide Post
HTML reports can handle it this way:

TABLE FILE CAR
SUM
SALES
BY COUNTRY

ON TABLE SUBFOOT
"TOTAL LINES: !IBI.AMP.LINES;"

ON TABLE HOLD AS H001 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN
!IBI.FIL.H001;
-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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
quote:
ON TABLE SUBFOOT
"TOTAL LINES: !IBI.AMP.LINES;"


Nice, hadn't considered this way before.

Good One


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
LET WebFOCUS= How many ways to skin a chicken (or what ever your local variant is)
 
Report This Post
Member
posted Hide Post
&LINES, is not calculated until AFTER the table file.
You could:
TABLE FILE SQLOUT
BY DUMMY
ON TABLE HOLD
END
-RUN
-SET &TOTLINES=&LINES;
TABLE FILE SQLOUT
. 
.
.
ON DUMMY SUBFOOT
"Total Refunds: &TOTLINES "

OR AN EASIER SOLUTION:
TABLE FILE SQLOUT
SUM COMPUTE CNTR/I4=CNTR+1; NOPRINT
BY DUMMY
.
.
.
.
ON DUMMY SUBFOOT
"Total Refunds: <ST.CNTR "

This message has been edited. Last edited by: Kerry,
 
Posts: 17 | Location: Colorado, USA | Registered: January 22, 2010Report This Post
Guru
posted Hide Post
Have you tried creating a define field.
Try this version of your report.
/*
DEFINE FILE SQLOUT
DUMMY/A1 = ' ';
RECORD_COUNT/I9=1;
END
TABLE FILE SQLOUT
BY DUMMY NOPRINT
-SET &LicenseNumber = IF &LicenseNumber EQ '' THEN FOC_NONE ELSE &LicenseNumber;
-SET &StartDate = IF &StartDate EQ '' THEN FOC_NONE ELSE &StartDate;
-SET &TaxPeriod = IF &TaxPeriod EQ '' THEN FOC_NONE ELSE &TaxPeriod;
WHERE ( Tax_period EQ '&TaxPeriod');
WHERE ( License_no EQ '&LicenseNumber');
WHERE ( Refund_Date FROM DT(&StartDate) TO DT(&EndDate) );
PRINT
License_no AS 'License,Number'
Trade_Name AS 'Trade,Name'
Legal_Name AS 'Legal,Name'
Tax_period AS 'Tax,Period'
Refund_Amount AS 'Refund,Amount'
Refund_Date/HMDYY AS 'Refund,Date'
SAP_Transmittal_Number AS 'SAP,Transmittal,Number'
BY DUMMY NOPRINT
ON DUMMY SUBFOOT
"Total Refunds: HEADING
"Refund Report:&DATEMDYY "

*/


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Gold member
posted Hide Post
ENGINE SQLMSS SET DEFAULT_CONNECTION LCIGAR
SQL SQLMSS PREPARE SQLOUT FOR
select TV.License_no, CL.Trade_Name, CL.Legal_Name, TV.Tax_period, TV.Transaction_Amount as 'Refund Amount', TV.Transaction_DTTM as 'Refund Date',
TV.DLN as 'SAP Transmittal Number' from transactionView TV
inner join clgninfo CL on TV.License_no = CL.license_no
where transaction_type = 'D'
order by TV.License_no, TV.Transaction_DTTM
;
END
TABLE FILE SQLOUT
ON TABLE HOLD
END
-RUN
-SET &TOTLINES=&LINES;
TABLE FILE SQLOUT
-SET &LicenseNumber = IF &LicenseNumber EQ '' THEN FOC_NONE ELSE &LicenseNumber;
-SET &StartDate = IF &StartDate EQ '' THEN FOC_NONE ELSE &StartDate;
-SET &TaxPeriod = IF &TaxPeriod EQ '' THEN FOC_NONE ELSE &TaxPeriod;
WHERE ( Tax_period EQ '&TaxPeriod');
WHERE ( License_no EQ '&LicenseNumber');
WHERE ( Refund_Date FROM DT(&StartDate) TO DT(&EndDate) );
PRINT
     License_no AS 'License,Number'
     Trade_Name AS 'Trade,Name'
     Legal_Name AS 'Legal,Name'
     Tax_period AS 'Tax,Period'
     Refund_Amount AS 'Refund,Amount'
     Refund_Date/HMDYY AS 'Refund,Date'
     SAP_Transmittal_Number AS 'SAP,Transmittal,Number'

BY DUMMY NOPRINT
ON DUMMY SUBFOOT
"Total Refunds: &TOTLINES "

HEADING
"Refund Report:&DATEMDYY "  


I tried this last suggestion and I have no idea why I cannot get this to work.

The help is greatly appreciated.


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Guru
posted Hide Post
Erney,

First of all can you please show us the reults of your report?
Another thing, you will only get the correct reuslts if you use the same selection criteria in both reports. Otherwise, the first report will give you the count of all the records on your output file and not the ones that matc hyour selection cirteria.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Expert
posted Hide Post
In your latest example, the column "DUMMY" does not exist.


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
Gold member
posted Hide Post
DEFINE FILE SQLOUT
DUMMY/A1 = ' ';
END
TABLE FILE SQLOUT
BY DUMMY NOPRINT
-SET &LicenseNumber = IF &LicenseNumber EQ '' THEN FOC_NONE ELSE &LicenseNumber;
-SET &StartDate = IF &StartDate EQ '' THEN FOC_NONE ELSE &StartDate;
-SET &TaxPeriod = IF &TaxPeriod EQ '' THEN FOC_NONE ELSE &TaxPeriod;
WHERE ( Tax_period EQ '&TaxPeriod');
WHERE ( License_no EQ '&LicenseNumber');
WHERE ( Refund_Date FROM DT(&StartDate) TO DT(&EndDate) );
ON TABLE HOLD
END
-RUN
-SET &TOTLINES=&LINES;
TABLE FILE SQLOUT
PRINT
     License_no AS 'License,Number'
     Trade_Name AS 'Trade,Name'
     Legal_Name AS 'Legal,Name'
     Tax_period AS 'Tax,Period'
     Refund_Amount AS 'Refund,Amount'
     Refund_Date/HMDYY AS 'Refund,Date'
     SAP_Transmittal_Number AS 'SAP,Transmittal,Number'
BY DUMMY NOPRINT
ON DUMMY SUBFOOT
"Total Refunds: &TOTLINES "
HEADING
"Refund Report:&DATEMDYY "  



OK i changed things up a bit in the code but im getting a "0" for &TOTLINES even though there are 3 records showing up on the report.


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Guru
posted Hide Post
Put these lines before the DEFINE

-SET &LicenseNumber = IF &LicenseNumber EQ '' THEN FOC_NONE ELSE &LicenseNumber;
-SET &StartDate = IF &StartDate EQ '' THEN FOC_NONE ELSE &StartDate;
-SET &TaxPeriod = IF &TaxPeriod EQ '' THEN FOC_NONE ELSE &TaxPeriod;


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Virtuoso
posted Hide Post
Am I missing something? Why all the holds and parameters?
TABLE FILE IBISAMP/EMPDATA
SUM COMPUTE CNTPIN/I9 = CNT.PIN; NOPRINT
PRINT  *
BY DEPT
HEADING 
"TOTAL RECORDS <TOT.CNTPIN"
ON TABLE SUBFOOT 
"CNT <TOT.CNTPIN"
END  


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Gold member
posted Hide Post
dhagen, you were correct. I used your code and it worked.

Thank you all for the contributions.


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Expert
posted Hide Post
dhagen, wouldn't that give you a count of the rows read by the request, not the number of rows in the output, so, good for a PRINT, but not for a SUM?


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
Virtuoso
posted Hide Post
F,

TABLE FILE IBISAMP/EMPDATA
SUM COMPUTE CNTPIN/I9 = CNT.PIN; NOPRINT
SUM SALARY COMPUTE CNTROWS/I9 = 1; NOPRINT
BY DEPT
HEADING 
"TOTAL RECORDS <TOT.CNTPIN"
ON TABLE SUBFOOT 
"CNT <TOT.CNTPIN <ST.CNTROWS"
END    


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report 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     [CLOSED] Why is getting total records on a report so difficult?

Copyright © 1996-2020 Information Builders