Focal Point
[NFR opened] Count of unique records, in report header

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

March 27, 2013, 05:02 AM
Peter
[NFR opened] Count of unique records, in report header
Hi,

Similarly to TRue's question, I'm trying to find out how I can put a count distinct in the header of a report.

As mentioned, a sub footer can be used in conjunction with a compute to achieve this,
but this approach:
- consistently returns 1 in a sub header
- consistently returns 1 in a report header
- generates an error when used in a report footer

--> How can I create a 'report summery' at the top of my report containing count distincts?

Regards,
Peter

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


Prod: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
Test: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
March 28, 2013, 09:09 AM
jgelona
Here's one way:
 TABLE FILE CAR
 COUNT DST.COUNTRY
 ON TABLE SAVE
 END
 TABLE FILE CAR
 COUNT DST.CAR
 ON TABLE SAVE AS SAVE1
 END
 TABLE FILE CAR
 COUNT DST.MODEL
 ON TABLE SAVE AS SAVE2
 END
-RUN
-READ SAVE &COUNTRY.5.
-READ SAVE1 &CAR.5.
-READ SAVE2 &MODEL.5.
-RUN
 TABLE FILE CAR
 HEADING
 "DISTINCT COUNTRIES: &COUNTRY"
 "DISTINCT CARS: &CAR"
 "DISTINCT MODELS: &MODEL"
 PRINT COUNTRY CAR MODEL SALES
 END



In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
April 08, 2013, 04:28 PM
David Beagan
For those who are on later releases (like Peter on WF8.0.01), below is jgelona's code in a more streamlined version. This is taking advantage of two newer features:

Multiple Distincts in one TABLE FILE
and
-READFILE

Here's the code:

TABLE FILE CAR
SUM CNT.DST.COUNTRY
    CNT.DST.CAR
    CNT.DST.MODEL
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS DISTINCT FORMAT BINARY
END
-RUN
-READFILE DISTINCT
TABLE FILE CAR
HEADING
"Distinct Countries: &COUNTRY "
"Distinct Cars: &CAR "
"Distinct Models: &MODEL "
PRINT COUNTRY CAR MODEL SALES
END  



WF 8.2.03
Win10 / IE11 / Chrome
HTML EXL2K PDF et. al.
April 09, 2013, 02:18 AM
Dave
@David Beagan

Owh man!

Didn't knew that. It's not in help ( index ) only when you search you'll find readfile.
Great, thanks!

But I do have a warning about using multiple cnt.dst in one TABLE.

Try this:
TABLE FILE CAR
SUM CNT.DST.COUNTRY
    CNT.DST.CAR
    CNT.DST.SEATS
ON TABLE PCHOLD FORMAT HTML
END

TABLE FILE CAR
SUM COMPUTE CD_COUNTRY/I11 = CNT.DST.COUNTRY;
    COMPUTE CD_CAR/I11 = CNT.DST.CAR;
    COMPUTE CD_SEATS/I11 = CNT.DST.SEATS;
ON TABLE PCHOLD FORMAT HTML
END


Although it seems this will give the same result... ...it doesn't. ( not on our environment anyways )


_____________________
WF: 8.0.0.9 > going 8.2.0.5
April 09, 2013, 03:55 AM
Peter
Thank you all for the responses.

I had hoped there was a way for an InfoAssist user to show report totals in the header without having to resort to hold-files, but I see this is not possible (for now).

+Note+: The suggestions made make use of -READ & -READFILE, but from what I can tell - these are options not available in InfoAssist 8.0.01 or 8.0.02


Prod: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
Test: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
April 20, 2013, 10:44 PM
<MLerner>
Peter,
Please open a new feature request and perhaps we can get this automated for you in a future release.

Regards,
Matthew