Focal Point
The count of records based on certain condition.

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

September 09, 2008, 11:59 AM
Gobinath Velusamy
The count of records based on certain condition.
Hi All,
I have a requirement where I need a count based on the certain condition.

For example :

Event
-------
Y
N
N
Y
N
Y
Y
Y
----------------------------------
Total Count:5 (i.e, The no of "Y")
----------------------------------

Can any one suggest me on this.

Thanks for your help in advance!

Regards,
Gopinath


WebFOCUS 7610
Windows
September 09, 2008, 12:05 PM
Prarie
How about a Define
Define file whatever
CNT/I3 = IF EVENT EQ 'Y' THEN 1 ELSE 0;
END


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Depending on how the value of Event is calculated, you can do this in a define or compute:

EVT_CNT/I8=IF EVENT EQ 'N' THEN 1 ELSE 0;



Then you can total it as you wish.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
Gopinath, I am suprised you are asking such a basic question!

Apart from what is suggested above, there are many ways to count the number of an occurance of a value.

Such as:
TABLE FILE x
COUNT FIELD
BY FIELD
END


OR for just the Y's
TABLE FILE x
COUNT FIELD
BY FIELD
WHERE FIELD EQ 'Y'
END


I would suggest that you become more familiar with DEFINE and COMPUTE and what you can do with them.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

SUM CNT.{RECORDS}
BY EVENT

any granular fieldname will do for the record count




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID