Focal Point
[SOLVED]counting records

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

May 22, 2013, 09:16 AM
Geoff Fish
[SOLVED]counting records
I have a counter(records) that I display in the footer of my report. it works fine there but when I move it to the header it gives me a count of 1 instead of 7263. I would prefer to display it in the header instead and am perplexed by why it renders correctly in the footer but not the header.

Any input is appreciated and suggestions as to why this behavior occurs would also be appreciated.

See my code below

TABLE FILE AS_ADMISSIONS_APPLICANT
COMPUTE CNTR/I6 = CNTR + 1; NOPRINT


HEADING
"&TOD"
"&DATE "
"&HEADING1"
"&HEADING2"
"Undergraduate Admissions Profile Report"
"For Term &TERM_CODE_KEY Student Type &STYP_CODE "
"Record Count '<'CNTR "
FOOTING
"Record Count '<'CNTR "

I had to add single quotes around the carats to get them to display in the message for some reason


Geoff Fish

This message has been edited. Last edited by: Geoff Fish,


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
May 22, 2013, 11:24 AM
jimbo
your compute for CNTR is off plus you need a direct operator on the CNTR field you are putting within the heading. here is what i came up with
TABLE FILE CAR
SUM COMPUTE CNTR/I6 = LAST CNTR + 1; NOPRINT
BY MODEL

HEADING
"&TOD"
"&DATE "
" "
" "
"Undergraduate Admissions Profile Report"
"For Term TERM_CODE_KEY Student Type STYP_CODE "
"Record Count <MAX.CNTR "
FOOTING
"Record Count <MAX.CNTR "
END  



7.7.04
Win2K3, Unix
Oracle 10G,SQL2K,XFOCUS,ESRI,BID,MRE,SELF-SERVICCE
May 22, 2013, 11:29 AM
MichaelBalle
DEFINE FILE CAR
  CNTR /I4 = 1;
END
TABLE FILE CAR
  SUM
    DEALER_COST
    RETAIL_COST
  BY COUNTRY
  BY CAR
  BY MODEL
  ON TABLE SET PAGE-NUM OFF
  HEADING
    "Heading - number of lines: <TOT.CNTR"
  FOOTING
    "Footing - number of lines : <TOT.CNTR"
END



WebFOCUS 7.6, 7.7
Windows, All Output formats
May 22, 2013, 12:50 PM
Geoff Fish
Unfortunately neither solution will work for me because I am using a PRINT not SUM. maybe I should have shown more code.
This all gets passed to very nice HTML page

see below

DEFINE FILE AS_ADMISSIONS_APPLICANT
ADDRESS/A160=AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.STREET1_LINE1 | ( '' || AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.STREET1_LINE2 );
PHONE/A20=AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.PHONE_AREA_CODE1 | ( '' || AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.PHONE_NUMBER1 );

E_DATE_1/YYMD='&E_DATE';
B_DATE_1/YYMD='&B_DATE';
END
TABLE FILE AS_ADMISSIONS_APPLICANT
PRINT
&MEASURES.(AND(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)).Measures.
COMPUTE CNTR/I6 = LAST CNTR + 1; NOPRINT
BY &SORTA.(BY(,,,,,,,,,,,)).Sort1.
BY &SORTB.(BY(,,,,,,,,,,,)).Sort1.
BY &SORTC.(BY(,,,,,,,,,,,)).Sort1.
HEADING
"&TOD"
"&DATE "
"&HEADING1"
"&HEADING2"
"Undergraduate Admissions Profile Report"
"For Term &TERM_CODE_KEY Student Type &STYP_CODE "
"Record Count '<'TOT.CNTR "
FOOTING
"Record Count '<'CNTR "


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
May 22, 2013, 01:27 PM
Alan B
I would expect MichaelBalle's example to work, even with PRINT.

What result are you getting?


Alan.
WF 7.705/8.007
May 22, 2013, 01:32 PM
Doug
Right you are, about "I would expect MichaelBalle's example to work, even with PRINT."

Some people just use &RECORDS or &LINES from a previous extract... Just be sure use use a -RUN first...
May 22, 2013, 01:59 PM
Geoff Fish
Your right it did work!

I did away with the compute and just used the define. Now TOT.CNTR works. thanks to all will mark closed


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
May 22, 2013, 02:04 PM
JL
MichaelBalle's example would work.

DEFINE CNTR = 1 : it is like creating an extra field named CNTR returned with each record in your dataset with a value of 1. If you sum up the values in thise column, you would get the number of records.
TOT.CNTR : this gives you the total of CNTR

A COMPUTE as in your original code is applied after the dataset is returned and thus, would not give you the correct number in the HEADING.

So try this ... remember to remove the COMPUTE CNTR statement.

DEFINE FILE AS_ADMISSIONS_APPLICANT
ADDRESS/A160=AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.STREET1_LINE1 | ( '' || AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.STREET1_LINE2 );
PHONE/A20=AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.PHONE_AREA_CODE1 | ( '' || AS_ADMISSIONS_APPLICANT.AS_ADMISSIONS_APPLICANT.PHONE_NUMBER1 );

E_DATE_1/YYMD='&E_DATE';
B_DATE_1/YYMD='&B_DATE';

CNTR/I11=1;
END
TABLE FILE AS_ADMISSIONS_APPLICANT
PRINT
&MEASURES.(AND(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)).Measures.
BY &SORTA.(BY(,,,,,,,,,,,)).Sort1.
BY &SORTB.(BY(,,,,,,,,,,,)).Sort1.
BY &SORTC.(BY(,,,,,,,,,,,)).Sort1.
HEADING
"&TOD"
"&DATE "
"&HEADING1"
"&HEADING2"
"Undergraduate Admissions Profile Report"
"For Term &TERM_CODE_KEY Student Type &STYP_CODE "
"Record Count <TOT.CNTR "
FOOTING
"Record Count <CNTR "



Year(s) of experience in WebFOCUS: 5+. Using WebFOCUS 7.7.03 on Windows platform with Oracle/SQL Server.
May 22, 2013, 03:17 PM
Geoff Fish
thanks to everyone that responded

Big Grin
geoff


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML