Focal Point
subtiotal on alpha field

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

October 18, 2007, 03:47 PM
Jay
subtiotal on alpha field
I have an alpha field which contains 'X', i need tp know how many 'X's I have in each column. How do I do this as a subtotal?


WebFocus 7.6.6
Oracle 10
Windows XP
October 18, 2007, 04:19 PM
FrankDutch
Jay

After 25 posts and registered since march 2007 you know what I mean if I say "signature"

The answer on your question:

TABLE FILE whatever
PRINT F_X 
COMPUTE TELLER/I4=IF F_X EQ 'X' THEN TELLER+1 ELSE TELLER; NOPRINT
FOOTING
"number of x: <TELLER "
ON TABLE COLUMN-TOTAL
END


I hope this works




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 18, 2007, 04:24 PM
Sayed
I think this is what you are looking for COUNTRY is your filed containing X

TABLE FILE CAR
PRINT
COMPUTE A/I1 = IF COUNTRY EQ 'ENGLAND' THEN 1 ELSE 0;
BY COUNTRY
ON COUNTRY SUBTOTAL AS 'TOTAL :'
END


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
October 22, 2007, 10:41 AM
Jay
I want the total number of 'X's in the column otherwise I have to create a subfoor for the compute fields then align the columns (which is extremly hard to do).

Yout totals seems to work on numeric fields.

I am using webfocus 7.6.2


WebFocus 7.6.6
Oracle 10
Windows XP
October 22, 2007, 01:09 PM
Darin Lee
I don't think your intended approach will work. There are subtotals that will work with alpha fields, but they are just that - subtotals - for an alpha field, that means the last value. You can also use the CNT. prefix, but that is just a count. You want to count only where a value equals 'X'. Could you just use a '1' instead of an 'X' and get what you need? Otherwise you'll need to define another column to subtotal or use in a footing/subfooting as Frank suggests.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 22, 2007, 02:31 PM
Francis Mariani
Here's one way to determine the number of X's in each row for a particular column.

I'm using the CAR file as an example. I'm using 'O' instead of 'X' in this example.

The STRIP function removes the specified character from the given string. The ARGLEN function returns the non-trailing-spaces length of a string. Combine STRIP and ARGLEN to determine the count of the specified character.

DEFINE FILE CAR
XSTRIP/A24 = STRIP(24, MODEL, 'O', 'A24');
XCOUNT/D4 = ARGLEN(24, MODEL, 'I4') - ARGLEN(24, XSTRIP, 'I4');
END
TABLE FILE CAR
PRINT
MODEL
XCOUNT
END


You will, of course have to fiddle about with SUBFOOT if you don't want the Count column in the report.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server