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     [SOLVED] Count Distinct Sort - Report Writer View

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Count Distinct Sort - Report Writer View
 Login/Join
 
Member
posted
Hi there,
Unfortunately at this time I do not have code edit access as many in this forum seem to, and I only have report writer view. I'm trying to sort a count of distinct values for a very basic report. However, when I attempt to put in the sort, it says FOC1867: operator must be at the lowest level of aggregation. I find it strange that one can't process a count of distinct values and then sort on it.

I've attempted the following:

1. Using the GUI editor, drag in the field I want a count distinct on, and click through the aggregation function to obtain count distinct. So far so good. When I sort, it errors out and won't run the report, throwing me error above.

2. create a virtual (define) field to first obtain a distinct count of orders and then attempt the sort. That did not work - it does not recognize the operator cnt.dst.[field name] and I'm not sure how to code this properly in the define field if not for "cnt.dst."

3. created a compute field just to see if anything would happen. While it accepted the "cnt.dst.[field name]" operator, it did not work when attempting to sort.

I've tried to sort in every way I could within the other report fields, but no matter what I do I cannot sort the number I want: the count of distinct orders.

Does anyone with experience in report writer view know how to obtain the expected result?

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8

Windows, All Outputs
 
Posts: 1 | Registered: March 12, 2018Report This Post
Virtuoso
posted Hide Post
Here is one way done in two steps :

TABLE FILE CAR
SUM COMPUTE NBCAR /P3 = CNT.DST.CAR;
BY COUNTRY
ON TABLE HOLD AS CNTDATA
END
-RUN

TABLE FILE CNTDATA
BY NBCAR
BY COUNTRY
END
-RUN


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Virtuoso
posted Hide Post
 
TABLE FILE CAR
SUM CNT.DST.MODEL
BY TOTAL HIGHEST CNT.DST.MODEL NOPRINT
BY COUNTRY
BY CAR
ON TABLE PCHOLD FORMAT HTML
END 


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
I can recreate MartinY's solution in the GUI.

I cannot figure out how to do BabakNYC's version in the GUI. Sometimes you can code it, then open it in the GUI and see what's highlighted to give you a clue. No luck this time.

Nice way to burn some time this morning, though!


WebFOCUS 8.2.03 - Production
WebFOCUS 8.2.04 - Sand Box
Windows 2012 R2 Server
HTML, PDF, Excel
In FOCUS since 1980
 
Posts: 115 | Location: Seattle, WA | Registered: April 07, 2015Report This Post
Virtuoso
posted Hide Post
To perform Babak option in GUI from new report :

1- Create the COMPUTEd field : NbModel /D5 = CNT.DST.MODEL
2- Insert the COMPUTEd filed into the report layout
3- Change it to a Sort Down instead of an Aggregate
4- Change its Sort Order for Down
5- Insert the Country field
6- Insert the Car field
7- Insert your COMPUTEd field as an Aggregate

It will result in this :
TABLE FILE CAR
SUM
     COMPUTE NbModel/D5 = CNT.DST.MODEL;
BY TOTAL HIGHEST COMPUTE NbModel/D5 = CNT.DST.MODEL;
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = warm,
$
ENDSTYLE
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Virtuoso
posted Hide Post
In InfoAssist, place MODEL under SUM and COUNTRY and CAR in BY.

Right Click MODEL, More, Aggregation Functions, Count Distinct. This generates DST.CNT.MODEL.

In the ribbon bar above you'll see two icons under the Sort Grouping. AZ and ZA. Click ZA to generate the BY TOTAL HIGHEST.

That should generate what I typed up.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
MartinY's instructions worked fine. It's just a different mindset.


WebFOCUS 8.2.03 - Production
WebFOCUS 8.2.04 - Sand Box
Windows 2012 R2 Server
HTML, PDF, Excel
In FOCUS since 1980
 
Posts: 115 | Location: Seattle, WA | Registered: April 07, 2015Report 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     [SOLVED] Count Distinct Sort - Report Writer View

Copyright © 1996-2020 Information Builders