Focal Point
[SOLVED] Calculation based on results of Summary

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

January 08, 2011, 07:23 AM
jammer
[SOLVED] Calculation based on results of Summary
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
January 08, 2011, 08:45 AM
GamP
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
January 08, 2011, 09:25 AM
jammer
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