for   
Save 
Save 
   Join IIUG  

Informix News
04 December 08 - Steeleye - Multicarta achieves 99.997% uptime for its Informix-based Credit Card Authorization Centre... Read
16 October 08 - VendorRate - Informix Earns Top Customer Satisfaction Score on VendorRate in Q3... Read
14 August 08 - IIUG.org - Sellout Expected for the 2009 IIUG Informix Conference... Read
29 April 08 - IntelligentEnterprise.com - IBM Informix Upgrade Enhances Clustering, Database Management... Read
29 April 08 - itweek.com - IBM 'Cheetah 2' mauls data costs... Read
28 April 08 - eWeek.com - IBM Uncages Cheetah 2 Data Server... Read
28 April 08 - CNNMoney.com - IBM Helps Clients Reduce Data Management Costs With New Informix Dynamic Server... Read
09 April 08 - CNNMoney.com - MediaSpan Embeds IBM Informix Dynamic Server Software for Delivering News to Print, Web and Wireless Devices... Read
08 April 08 - IT-Director.com - Informix seeks developers... Read
18 February 08 - marketwire.com - Icarus Studios Partners With IBM to Upgrade Performance, Availability for Its Online Games... Read
17 January 08 - eWeek.com - IBM Adds Mac Support to IDS for Higher Education... Read
17 January 08 - informationweek.com - Lotus Notes For iPhone Signals Closer Ties Between IBM, Apple... Read
16 January 08 - marketwire.com - IBM Informix Dynamic Server to Deliver Support for Mac OS X... Read
16 January 08 - internetnews.com - IBM's IDS to Support Mac Platform... Read
28 June 07 - REG Developer - IBM and Informix tie down Cheetah... Read
27 June 07 - CBRonline.com - IBM corrects its own Informix customer figures... Read
14 June 07 - vnunet.com - IBM changes spots with Informix 'Cheetah' database... Read
14 June 07 - eChannelLine - IBM expands scope for IDS... Read
14 June 07 - Resellernews - IBM: Informix database alive and kicking... Read
13 June 07 - DB2 Magazine - Cheetah is now out of the gate... Read
12 June 07 - IBM - IDS 11 release announcement (pdf)... Read
12 June 07 - ChannelWeb Network - IBM Uncages IDS 11, Aka Cheetah, Database... Read
12 June 07 - eWeek.com - IBM's 'Cheetah' Ready to Pounce... Read
12 June 07 - InformationWeek - IBM Unleashes 'Cheetah' Database... Read
12 June 07 - WebWire - IBM Strengthens Database Portfolio With New Informix Dynamic Server... Read
12 June 07 - Intelligent Enterprise - IBM Unveils Informix Upgrade... Read
12 June 07 - ComputerWeekly.com - IBM's Cheetah IDS makes leap to better data centre clustering... Read
12 June 07 - ebiz - IBM Unveils Next Generation Informix Dynamic Server... Read
12 June 07 - computerworld.com - Will 'Cheetah' help IBM's Informix chase down market share?... Read
12 June 07 - Internetnews.com - No Data Can Outrun This 'Cheetah'... Read
12 June 07 - de.internet.com - IBM neuer Datenbank-Server mit Codenamen Cheetah ist fertig... Read
12 June 07 - verifox.de - IBM stärkt Datenbank-Portfolio mit neuem Informix Dynamic Server... Read
12 June 07 - golem.de - Informix 11 vorgestellt... Read
12 June 07 - Computerwoche.de - IBM stellt neue Informix-Version vor... Read
12 June 07 - IBM.de - IBM stärkt Datenbank-Portfolio mit neuem Informix Dynamic Server... Read
12 June 07 - Heise - IBM gibt Informix 11 frei... Read
25 May 07 - Taiwan.CNET.com - Local Taiwan Informix user group established... (Chinese language) ... Read
18 May 07 - ChannelWeb Network - IBM Musters Partners For Cheetah Release... Read
18 May 07 - eWeek.com - IBM Looks to 'Cheetah' to Speed Up Blade Servers... Read
7 May 07 - DB2 Magazine - SQL Shortcuts - Use these tricks to generate IDS SQL scripts... Read

Previous news items
 

Home Member Area About IIUG


Resources
IIUG Insider
IIUG Hotspots
IBM-Informix Links
IIUG RSS Feeds
Software Repository
Informix Products
Online Resources
Informix Library
Informix Books
IIUG Banners
Discussion
Technical Special
  Interest Groups

Other Discussion
Community
Events
Webcasts/Chat w Lab
IIUG TV
IIUG Sponsors
Informix Business Directory
IIUG Press Partners
Local User Groups
Rate the Vendor
Job Board
Fun Stuff

[ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

Classics Forum

Re: RE: save aggregate as variable in report

Posted By:
Date:





I saw your THANKS message -- I was amused that it got the tag number 101.

It isn't clear to me what your computations are doing - why you are summing
some values and counting others, for example.

Be aware that your B.G.O clause is dealing with grand totals - over the
entire report data set - not per group totals. And note that the code
shown is syntactically incorrect -- see the inserted line I added.

What I think you might want to do is:

DEFINE
VARIABLE var DECIMAL
END

...big chunk omitted...

AFTER GROUP OF hist_coopcode
IF hist_coopcode = "lis" THEN
BEGIN
LET var = 3 * (GROUP TOTAL OF hist_sze WHERE hist_coopcode =
"lis")
PRINT "Coop Code: ", hist_coopcode, COLUMN 15, " = ", COLUMN
18, var USING "####.##"
END
ELSE IF hist_coopcode = "021" THEN
BEGIN
LET var = 6 * (GROUP COUNT WHERE hist_coopcode = "021")
PRINT "Coop Code: ", hist_coopcode, COLUMN 15, " = ", COLUMN
18, var USING "####.##"
END
...

And then your ON LAST ROW block might read:

ON LAST ROW
LET var = 3 * (TOTAL OF hist_sze WHERE hist_coopcode = "lis") +
6 * (COUNT WHERE hist_coopcode = "021") +
...
PRINT "Total sales:", COLUMN 18, var USING "###&.&&"

Note that the WHERE clauses in the A.G.O block are technically redundant
(when the hist_coopcode = "021", the GROUP COUNT is only for the case where
hist_coopcode = "021"), but they clarify the code in the ON LAST ROW block.
You could also print the expressions on the RHS of the LET statements
directly in the PRINT statements in the A.G.O block, but again, the code is
clearer as written. Indeed, the BEGIN and END can be removed because a
single PRINT in the A.G.O block would do the job:

AFTER GROUP OF hist_coopcode
IF hist_coopcode = "lis" THEN
LET var = 3 * (GROUP TOTAL OF hist_sze WHERE hist_coopcode =
"lis")
ELSE IF hist_coopcode = "021" THEN
LET var = 6 * (GROUP COUNT WHERE hist_coopcode = "021")
...

PRINT "Coop Code: ", hist_coopcode, COLUMN 15, " = ", COLUMN 18, var
USING "####.##"

This is perhaps the best reason for introducing the variable - it makes it
clear what's different (the computed value) and what's the same (the print
formatting).

Also, I'm highly dubious about those hard-wired 3 and 6 values; those
should be being retrieved from the database, so that the multiplication is
done between two selected values.

If it were not for the odd-ball case with TOTAL versus everything else with
COUNT, then you might be able to handle the ON LAST ROW clause with a
suitable TOTAL OF clause. This is a domain-specific issue -- only you know
what a coopcode is, and why the rules are as they are. Note that if you
need to add coopcode "039" at some point, you have to do major surgery on
the report.

--
Jonathan Leffler (jleffler@us.ibm.com)
STSM, Informix Database Engineering, IBM Data Management Solutions
4100 Bohannon Drive, Menlo Park, CA 94025
Tel: +1 650-926-6921 Tie-Line: 630-6921
"I don't suffer from insanity; I enjoy every minute of it!"


|---------+---------------------------->
| | "JAY ZWAGERMAN" |
| | <jay2@iafalls.com|
| | > |
| | Sent by: |
| | forum.subscriber@|
| | iiug.org |
| | |
| | |
| | 02/27/2003 09:31 |
| | AM |
| | |
|---------+---------------------------->
>---------------------------------------------------------------------------------------------------------------------------------------------|
| |
| To: classics@iiug.org |
| cc: |
| Subject: Re: RE: save aggregate as variable in report [92] |
| |
>---------------------------------------------------------------------------------------------------------------------------------------------|




Let me clarify my question and give my code. Here is the bottom part of my
ace report. In the before group of, you see that I use if else statements
to find 4 different totals. I can’t do a group total of in the “on last
row” and when I do ust a total of in "on last row" It doesn't give me a
total of the computed numbers.

format

page header
print column 30, "The Spokesman"
skip 1 line
print column 20, "Web Sales Total",1 space,userbdate," -
",useredate
skip 1 line
print column 25, "Coops: 001 - 017 - 021 - lis"

before group of hist_coopcode
if hist_coopcode = "lis" then
print "Coop Code: ",hist_coopcode,column 15," = ",column 18,
total of (hist_sze * 3.00) using "####.##"
else if hist_coopcode = "021" then
print "Coop Code: ",hist_coopcode,column 15," = ",column 18,
count * 6 using "####.##"
[...JL: there's a line missing here...probably 'else if hist_coopcode =
"017" then'...]
print "Coop Code: ",hist_coopcode,column 15," = ",column 18,
count * 3 using "####.##"
else if hist_coopcode = "001" then
print "Coop Code: ",hist_coopcode,column 15," = ",column 18,
count * 3 using "####.##"
on last row
print "Total sales:" SOMETHING


Here is the output so far

Input begin date (using MMDDYY):02012003




The Spokesman

Web Sales Total 02/01/2003 - 02/28/2003

Coops: 001 - 017 - 021 - lis
Coop Code: 001 = 372.00
Coop Code: 017 = 372.00
Coop Code: 021 = 744.00
Coop Code: lis = 247.50
Total sales:



Messages In This Thread

  • save aggregate as variable in report
    JAY ZWAGERMAN -- Tuesday, 15 April 2003, at 3:55 p.m.
    • RE: save aggregate as variable in report
      Simmons, Keith -- Tuesday, 15 April 2003, at 3:55 p.m.
    • RE: save aggregate as variable in report
      Jim Noble -- Tuesday, 15 April 2003, at 3:55 p.m.
    • RE: save aggregate as variable in report
      Jim Noble -- Tuesday, 15 April 2003, at 3:55 p.m.
      • Re: RE: save aggregate as variable in report
        JAY ZWAGERMAN -- Tuesday, 15 April 2003, at 3:55 p.m.
        • Re: RE: save aggregate as variable in report
          Marie Ann Mercado -- Tuesday, 15 April 2003, at 3:55 p.m.
        • Re: RE: save aggregate as variable in report
          Marie Ann Mercado -- Tuesday, 15 April 2003, at 3:55 p.m.
          • THANKS
            JAY ZWAGERMAN -- Tuesday, 15 April 2003, at 3:55 p.m.
        • Re: RE: save aggregate as variable in report
          Jonathan Leffler -- Tuesday, 15 April 2003, at 3:55 p.m.
    • RE: save aggregate as variable in report
      Konikoff, Rob (Contractor) -- Tuesday, 15 April 2003, at 3:55 p.m.
    • Re: save aggregate as variable in report
      Jonathan Leffler -- Tuesday, 15 April 2003, at 3:55 p.m.
      • RE: save aggregate as variable in report
        Konikoff, Rob (Contractor) -- Tuesday, 15 April 2003, at 3:55 p.m.

[ Post Response ] [ Return to Index ] [ Read Prev Msg ] [ Read Next Msg ]

Classics Forum is maintained by Administrator with WebBBS 5.12.

©2001 - 2007 International Informix Users Group.   All rights reserved.     Terms of use    
*** Powered By IBM Informix Dynamic Server V10.00 ***