Focal Point
WEBFOCUS Duplicates

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

December 20, 2007, 11:02 AM
arieger
WEBFOCUS Duplicates
How do you sum the results of an alphanumeric field to not display just the last value.

For Example:
My output for a particular field is

X
X
X
X
Y
Y
Y
Z
Z


I just want it to be displayed as

X
Y
Z
December 20, 2007, 11:17 AM
jimster06
We might need a bit more information here:

If the first instance of X were REFRIGERATOR and the second instance were RANGE, what would be the expected output?

BTW - please update your signature to include produst and release info.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
December 20, 2007, 11:18 AM
Darin Lee
SUM FIELD1
BY FIELD1 NOPRINT

You just need to summarize, sorting by unique values. If you just sum an alpha field, you always get the last value.


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
December 20, 2007, 11:40 AM
arieger
Sorry, I am a brand new intern this is all new to me. I will update my sign to make things easier. I work for an insurance company and I have a report that goes something like this:

INC_ID(NOT VISIBLE)(BY) LOCATION(BY) INC_COUNT(SUM) ADDRESS(SUM) CITY(SUM) COUNTY(SUM) TYPE(DETAIL
------------------- ------------ -------------- ------------ --------- ----------- -----------
xxxxxx xxxxxxxxx 30 xxxxxxx xxxxx xxxxxxx Multi-User
Multi-User
Multi-User
Single-User
Single-User

When I sum the TYPE field it will just give me in this case Single user which is the last record. I want it to diplays all of the records for this field that are used but only a single time for each with a count at the end (ex. Multi-User - 3 or Single-User - 2). Now there are about 20 possible result for the TYPE Field. Do I need to create a count for each possible result or is there and easier way to do this? I am using WEBFOCUS 7.1.4 and this particular report is going to be EXCEL Format.
December 20, 2007, 11:41 AM
arieger
The format for the previous post didnt come out as planned
December 20, 2007, 12:34 PM
Leah
quote:
INC_ID(NOT VISIBLE)(BY) LOCATION(BY) INC_COUNT(SUM) ADDRESS(SUM) CITY(SUM) COUNTY(SUM) TYPE(DETAIL


So is your code

TABLE FILE ....
SUM INC_COUNT NOPRINT
ADDRESS CITY COUNTY
BY LOCATION
PRINT TYPE
BY LOCATION
????


Leah
December 20, 2007, 12:39 PM
GinnyJakes
Does this help? Maybe you can use it as a model. The CAR file comes with WebFOCUS and you can use it to develop technique.

TABLE FILE CAR
SUM CNT.BODYTYPE
BY COUNTRY
BY BODYTYPE
END  


Run this code from an adhoc or console window to see what you get and compare it to what you want.


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
December 20, 2007, 01:36 PM
arieger
Okay here is the code:
[code]
SUM
CNT.INCIDENT_ID AS 'INCIDENT_COUNT'
ADDRESS
CITY
COUNTY_DESC AS 'COUNTY'
BY TOTAL HIGHEST INCIDENT_ID NOPRINT
BY LOCATION_CODE
PRINT
INC_TYPE AS 'Work Order Type'
BY TOTAL HIGHEST INCIDENT_ID NOPRINT
BY LOCATION_CODE
[code]

Now everything is displaying like it is suppose to except (INC_TYPE)... Say that the CNT.INCIDENT_ID Field has a record of 48. The report will display the 48 INC_TYPE's, many of these results have the same INC_TYPE. I do not want to display all 48 INC_TYPES seperately. I want to compress the similiar records together with a count to represent the number of INC_TYPE's. Instead of having INC_TYPE 'multi-user' shown 15 different times I want to to show 'multi-user - 15'.
December 20, 2007, 01:42 PM
wf1998
SUM
CNT.INCIDENT_ID AS 'INCIDENT_COUNT'
ADDRESS
CITY
COUNTY_DESC AS 'COUNTY'
BY TOTAL HIGHEST INCIDENT_ID NOPRINT
BY LOCATION_CODE
BY INC_TYPE NOPRINT
PRINT
INC_TYPE AS 'Work Order Type'
BY TOTAL HIGHEST INCIDENT_ID NOPRINT
BY LOCATION_CODE

use by filed in first verb
like BY INC_TYPE NOPRINT




Env Prod:WebFOCUS 7702 ,Windows xp on 64, SQL Server 2008, IRF Tool
Env 1 Local: DevStudio 7702 - MS Windows XP SP2 - Apache Tomcat 5.0.28
Output: HTML, Excel and PDF
December 21, 2007, 05:00 AM
<JG>
wf1998, That will not work.

You can not have more BYs in the first part of a multi-verb request than the last
and the BYs in the first part of the request must be the same and in the same order
as the corresponding BYs in the second part of the request.

For this request you do not even need a multi-verb request

DEFINE FILE CAR
MODEL_CNT/I5=1;
END
TABLE FILE CAR
SUM DEALER_COST
COMPUTE CNT_MODEL/I5=MODEL_CNT;
BY TOTAL HIGHEST CNT_MODEL NOPRINT
BY COUNTRY
BY CAR
END
December 21, 2007, 12:00 PM
Leah
Count distinct may help.

SUM CNT.DST....

Only thing is the 'pickyness' of where DST will work.


Leah