Hi, i think for you guys this is quiet easy. I want to make a distinct count on a table file. And i have only one column as result. I want to put this result into a &variable to use it for an output.
Regards
ChristianThis message has been edited. Last edited by: ChristianP,
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT
September 14, 2011, 10:03 AM
Doug
Consider HOLDing your selection and using &LINES or &RECORDS.
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
September 14, 2011, 10:10 AM
Tom Flynn
-SET &ECHO=ALL;
APP APPENDPATH IBISAMP
-RUN
TABLE FILE CAR
SUM
CNT.DST.COUNTRY
ON TABLE SAVE
END
-RUN
-READ SAVE &CNTRY_CNT.I5.
-TYPE &CNTRY_CNT
-EXIT
Output:
ALPHANUMERIC RECORD NAMED SAVE
0 FIELDNAME ALIAS FORMAT LENGTH
COUNTRY COUNTRY I5 5
COUNTRY COUNTRY A10 10
TOTAL 15
-READ SAVE &CNTRY_CNT.I5.
-TYPE 5
One caveat: The length of the saved field may be 5 or 9, depending on SET COUNTWIDTH.
- Jack Gross WF through 8.1.05
September 14, 2011, 10:43 AM
j.gross
quote:
Originally posted by Doug: Consider HOLDing your selection and using &LINES or &RECORDS.
More specifically, HOLD the list of distinct values, as in
TABLE FILE CAR
COUNT ENTRIES BY SEATS
ON TABLE HOLD
END
&LINES = 3 <--
&RECORDS = 18
If you just HOLD the count, &LINES will be one, while &RECORDS will be the number of records contributing to the result set, not the count of distinct values.
TABLE FILE CAR
WRITE CNT.DST.SEATS
ON TABLE HOLD
END
&LINES = 1 <--
&RECORDS = 18
September 14, 2011, 10:50 AM
ChristianP
Hi Tom,
looks great!! But i don't understand why webfocus knows that COUNTRY = CNTRY. Strange!!
Regards
Christian
WF Production Version: 7.7.02M WF Test Version: 7.7.02M Developer Studio: 7.7.02 HTML, EXL2K, FLEX, PDF,PPT
September 14, 2011, 11:00 AM
Tom Flynn
I don't even know why COUNTRY = CNTRY? What do you mean?
The example is doing a -READ(Dialogue Manager) and setting the ampere &CNTRY_CNT and the ampere has the value of the DISTINCT COUNT...
Jack, Never used COUNTWIDTH = ON; seems a waste, really:
-SET &ECHO=ALL;
APP APPENDPATH IBISAMP
-RUN
TABLE FILE CAR
SUM
CNT.DST.SEATS/I11
ON TABLE SAVE
END
-RUN
-READ SAVE &CNTRY_CNT.I11.
-TYPE &CNTRY_CNT
-EXIT