|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Gold member |
Hi,
I would like to display the distinct count of a field in subheading. Does any one has ideas on how to do this? Thanks. |
||
|
|
Master |
CNT.DST.itemkey, as a verb object, gives the count. Not sure you can imbed such a construct in a header/footer, as " <CNT.DST.itemkey " If not, substitute a COMPUTEDd field, like so:
TABLE ... SUM CNT.DST.itemkey NOPRINT COMPUTE distinct/I5C= CNT.DST.itemkey; NOPRINT BY XXX BY YYY BY ZZZ ON XXX SUBHEAD "... <distinct ..." END |
|||
|
|
Virtuoso |
The DST operator is picky in the sense that is only on SUM or WRITE verbs and it must be at the lowest level on the aggregation chain.
So this works SET STYLEMODE= FIXED TABLE FILE CAR SUM CNT.DST.MODEL BY COUNTRY END but this doesn't SET STYLEMODE= FIXED TABLE FILE CAR SUM CNT.DST.MODEL PRINT COUNTRY MODEL BY COUNTRY END 0 ERROR AT OR NEAR LINE 28 IN PROCEDURE _ADHOCRQFOCEXEC * (FOC1867) DST OPERATOR MUST BE AT THE LOWEST LEVEL OF AGGREGATION So for unique counts you may want to create a unique counter field and ensure the file is in the order wanted when creating. This works SET STYLEMODE= FIXED TABLE FILE CAR PRINT COUNTRY MODEL COMPUTE CNTR/I4 = IF MODEL EQ LAST MODEL THEN 0 ELSE IF COUNTRY NE LAST COUNTRY THEN 1 ELSE 1; BY COUNTRY NOPRINT BY MODEL NOPRINT ON TABLE HOLD AS HOLD1 END TABLE FILE HOLD1 SUM CNTR NOPRINT BY COUNTRY PRINT MODEL BY COUNTRY ON COUNTRY SUBHEAD " " "UNIQUE MODELS ARE <CNTR" " " END Of course the car file doesn't have a lot of models and you may not want to use a hold file. A define would work if the input file is in the order wanted. |
|||
|
|
Gold member |
Both solutions are great. Thank you very much guys!
|
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

