Focal Point
[SOLVED] Calculating SUM for an Integer data type

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

April 21, 2013, 08:56 PM
touch
[SOLVED] Calculating SUM for an Integer data type
I am trying to add up the amount values and display that in the footer. The amount value is an SQLOUT output from Postgres and is of I11 format

-* amount                 E11           I11


I tried converting it into Packed Decimal using ITOPACK but ran across syntax errors. What I want to eventually do is calculate the sum and then display that in the report footer as follows

  
MAINFOOTER/A122 = 'TRANSACTIONS    '| DATE | AMOUNT;


Where can I exactly carry out the calculation and display it? (in place of AMOUNT in the above line) I tried doing a SUM(amount) but it complains that it cannot understand the expression

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


WebFOCUS 7.6
Windows, All Outputs
April 22, 2013, 01:04 AM
FrankDutch
Did you get som basic training. Got any documentation?

Do you know how to build a basic report on a database.
What was the code you tried and what exactly was the error?
There is so much , but where can we start....




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

April 22, 2013, 05:21 AM
Wep5622
WebFOCUS doesn't do implicit type casts, so you can't just concatenate alpha and numeric values like that. You'll first have to convert the numeric values to alphanumeric, for example using EDIT or FPRINT.

What are you trying to achieve by converting that integer into packed decimal?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
May 02, 2013, 10:51 PM
touch
Hi guys,

sorry for the delay. figured a way out.

I was thinking converting to packed decimal might work for sum but i can do it using integer. simply by creating a define and then reading it

Something along the lines of


TABLE FILE CITYLINKHOLD
SUM amount/I9L
ON TABLE SAVE AS SAVE1
END
-RUN

-READ SAVE1 &SUMVALUE.A9.
-RUN

  


Still getting use to the focus language! will get there soon.


WebFOCUS 7.6
Windows, All Outputs