 Focal Point Focal Point Forums WebFOCUS/FOCUS Forum on Focal Point [SOLVED] Calculation based on results of Summary
 Go New Search Notify Tools Reply  [SOLVED] Calculation based on results of Summary Gold member posted January 08, 2011 07:23 AM
I am not sure how to do define the CALC column.
See the sample data below

CONTRACT CLASS TYPE AMT CALC
A100 A A -200 0
A100 A B 100 0
B100 A A -100 -100
B100 A B 200 200

If the sum of the CONTRACT AMT is positive th CALC = AMT.
If the sum of the CONTRACT AMT is negative the CALC column = 0

In this example:
- Since Sum Contract A100 Amt = -100 the CALC would be 0
- Since Sum Contract B100 Amt = +100 the CALC would be the amt

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

Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat

 Posts: 79 | Registered: May 02, 2006   IP
Virtuoso posted January 08, 2011 08:45 AM Hide Post
A multi-set request is in order here. Try the following example:
```FILEDEF DATA DISK DATA.MAS
-RUN
-WRITE DATA FILENAME=DATA, SUFFIX=FIX
-WRITE DATA FIELD=CONTRACT, FORMAT=A4, ACTUAL=A4, \$
-WRITE DATA FIELD=CLASS   , FORMAT=A4, ACTUAL=A4, \$
-WRITE DATA FIELD=TYPE    , FORMAT=A4, ACTUAL=A4, \$
-WRITE DATA FIELD=AMOUNT  , FORMAT=I6, ACTUAL=A6, \$

FILEDEF DATA DISK DATA.TXT
-RUN
-WRITE DATA A100   A   A  -200
-WRITE DATA A100   A   B   100
-WRITE DATA B100   A   A  -100
-WRITE DATA B100   A   B   200

TABLE FILE DATA
SUM AMOUNT
BY CONTRACT
SUM AMOUNT
COMPUTE CALC/I6 = IF C1 LT 0 THEN 0 ELSE AMOUNT;
BY CONTRACT
BY CLASS
BY TYPE
END```
Hope this helps ...

GamP

 - Using AS 8.2.01 on Windows 10 - IE11. in Focus since 1988

 Posts: 1960 | Location: Netherlands | Registered: September 25, 2007   IP
Gold member posted January 08, 2011 09:25 AM Hide Post
Thanks GamP

I am so inept at the multi-verb statement! This should work

Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat

 Posts: 79 | Registered: May 02, 2006   IP
 Reply  Focal Point Focal Point Forums WebFOCUS/FOCUS Forum on Focal Point [SOLVED] Calculation based on results of Summary