September 09, 2008, 11:59 AM
Gobinath VelusamyThe 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
September 09, 2008, 12:05 PM
PrarieHow 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 |
September 09, 2008, 12:08 PM
GinnyJakesDepending 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
September 10, 2008, 05:34 PM
WazGopinath, 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.04 | Upgrade: | WebFOCUS 8.2.07 | OS: | Linux |
Outputs: | HTML, PDF, Excel, PPT |
In Focus since 1984 |
Pity the lost knowledge of an old programmer! |
September 10, 2008, 07:16 PM
susannahSUM 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 |