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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
Count of records
 Login/Join
 
<msam>
posted
Hi All,
I have a requirement where I need a count based on the following requirement.

PA PV PS PE Count
-----------------------
A 1 0 2001 1
A 1 0 2001
A 2 0 2002 1
B 1 0 2001 1
B 1 0 2001 1
-----------------------
Total Count:4
-----------------------

Can any one suggest me on this

Regards,
MSAM
 
Report This Post
<msam>
posted
quote:
PA PV PS PE Count
-----------------------
A 1 0 2001 1
A 1 0 2001
A 2 0 2002 1
B 1 0 2001 1
B 1 0 2001
-----------------------
Total Count:3
-----------------------
 
Report This Post
Virtuoso
posted Hide Post
ON TABLE COLUMN-TOTAL COUNT

OR

ON TABLE SUBFOOT
"TOTAL COUNT: '<'ST.COUNT"

With no ' ' on the <

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


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
<msam>
posted
Hi Praire,
I need to build the Count Column ..

MSAM
 
Report This Post
Virtuoso
posted Hide Post
what it the criteria to have a count?


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
quote:
PA PV PS PE Count
-----------------------
A 1 0 2001 1
A 1 0 2001



Assumption you are sorting on the PA column

PRINT PV PS PE
COMPUTE COUNTPA/I5S = IF PA EQ LAST PA THEN 0 ELSE 1; AS 'COUNT'
ON TABLE COLUM-TOTAL AS 'TOTAL COUNT:'


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
<msam>
posted
well it is checking all the distinct values from the first 4 coulms as shown and based on that I need a Count

MSAM
 
Report This Post
Virtuoso
posted Hide Post
quote:
PRINT PV PS PE
COMPUTE COUNTPA/I5S = IF PA EQ LAST PA THEN 0 ELSE 1; AS 'COUNT'
ON TABLE COLUM-TOTAL AS 'TOTAL COUNT:'



Then you need to sort on all and manipulate the compute as shown above, it currently looks at distinct values of PA


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Master
posted Hide Post
Here is what I would do
TABLE FILE .....
PRINT PV PS PE
AND COMPUTE MYCNTR/I9 = IF PV EQ LAST PV AND PS EQ LAST PS AND PE EQ LAST PE THEN 0 ELSE 1; AS 'Count'
BY PV NOPRINT
BY PS NOPRINT
BY PE NOPRINT
ON TABLE SUBFOOT
"Total Count: <TOT.MYCNTR "
...
END




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
<msam>
posted
Thanks Leah And TexasStringay For the support !!
 
Report This Post
Virtuoso
posted Hide Post
You are most welcome.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Gold member
posted Hide Post
Hi,

Is there any similar command in Webfocus as that of COUNT(*) in oracle ? I need to get the total record count and if the count is 0 I need to do some other branching.

Can any body help me ?

Regards,
Johney.


Version 7.6.11
Webfocus installed in AIX 5.3,
desktop PC: Windows-XP based
Output: Excel, HTML, PDF
 
Posts: 83 | Registered: October 19, 2007Report This Post
Expert
posted Hide Post
Johney,

Of course -

TABLE FILE filename
WRITE CNT.fieldname
......

Be sure to check the SQL produced (using the method that Francis has posted so many times before), to ensure that you do not end up issuing a request that results in a table space scan Frowner

... or use SQL passthru.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
You can also do:
TABLE FILE CAR
COUNT *
END
If you are wanting to do conditional branching when there are no records, you might want to place a -RUN command after your request and then
-IF &LINES EQ 0 GOTO myroutine;

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


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
PB,

You have to be mindful of the SQL being produced in the background and therefore being passed to the RDBMS.

For instance, you would think that SUM CNT.field, WRITE CNT.field or COUNT * would all produce the same SQL as they are basically synonyms. Well they haven't always.

WRITE CNT.field was the only method of ensuring COUNT(*) being produced in the MVS DB2 interface at one time, hence the suggestion that the SQL is trapped before running in anger to ensure that no table space scan would be performed in getting the results.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Just out of interest, I have just run the four main methods against an Oracle source and got the following SQL -

SUM CNT.fieldname - SELECT COUNT(T1.fieldname) FROM tablename T1

ADD CNT.fieldname - SELECT COUNT(T1.fieldname) FROM tablename T1

WRITE CNT.fieldname - SELECT COUNT(T1.fieldname) FROM tablename T1

COUNT * - SELECT COUNT(T1.mainkeyfield) FROM tablename T1

Worth checking though Wink

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
msam
have you experimented with count distinct ?
SUM CNT.DST.PA
which gives you the count of the distincly different values in your PA field, which seems to be what you're doing.
-s.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders