February 01, 2012, 04:08 PM
Rodney ChanReport - ON TABLE SUMMARIZE - Unable to do min of column?
This has to be like one of the smallest things ever but i cant get it (really bugging me)
I have a report with a final line at the end where it gives the average (AVE) of the column
I have
ON TABLE SUMMARIZE
AVE. MINWT AS 'NEXT AVAILABLE'
Now, i want to simply change it to look for the MIN of that column but it doesnt work?
ON TABLE SUMMARIZE
MIN. MINWT AS 'NEXT AVAILABLE'
I tried totalling, max(MAX) and average (AVE), count (CNT) of the column and they all work, i just cant use MIN
Is there a special command I am missing?
Thanks
February 01, 2012, 04:32 PM
Francis MarianiNone of the prefixes work very well if placed after ON TABLE SUMMARIZE (in v7.7.02):
TABLE FILE CAR
SUM
SALES
WHEELS
WEIGHT
BY COUNTRY
BY CAR
ON TABLE SUMMARIZE
CNT.WHEELS
END
That gives me a Total line with a value of 10 for each of the measures columns - not what you're expecting I imagine.
MIN and MAX put the maximum values of each column, even though I only specify one column.
I have to say I've never done this before...
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
February 02, 2012, 01:41 AM
SriAravindRodney Chan - See the below code using MIN of the column which retrieving the minimum value. Is this the result you are looking for?
TABLE FILE CAR
SUM
DEALER_COST
BY CAR
ON TABLE SUMMARIZE
MIN.DEALER_COST AS 'MINDCOST'
END
CAR DEALER_COST
---- -------------
ALFA ROMEO 16,235
AUDI 5,063
BMW 49,500
DATSUN 2,626
JAGUAR 18,621
JENSEN 14,940
MASERATI 25,000
PEUGEOT 4,631
TOYOTA 2,886
TRIUMPH 4,292
----------------------------
MINDCOST 2,626
-----------------------------
February 02, 2012, 10:19 AM
Rodney ChanHey Francis
Good to know its not just me but an IBI thing!
SriAravind yup thats what I am looking for.
After some further digging into my report, it seems that some values in the style sheet seem to be conflicting with the MIN value for i really dont know what reason.
If i left my style sheet as is i get the following
TABLE FILE CAR
SUM
DEALER_COST
BY CAR
ON TABLE SUMMARIZE
MIN.DEALER_COST AS 'MINDCOST'
END
CAR DEALER_COST
---- -------------
ALFA ROMEO 16,235
AUDI 5,063
BMW 49,500
DATSUN 2,626
JAGUAR 18,621
JENSEN 14,940
MASERATI 25,000
PEUGEOT 4,631
TOYOTA 2,886
TRIUMPH 4,292
----------------------------
MINDCOST 0
-----------------------------
Very odd behaviour! I will talk to the end user and see if they want their pretty colors or if they want the right value
Though I did notice that if there are NULL values the MIN will take this into account. Would anyone know how i can exclude NULLs from being used in the MIN?
For example using the above code
TABLE FILE CAR
SUM
DEALER_COST
BY CAR
ON TABLE SUMMARIZE
MIN.DEALER_COST AS 'MINDCOST'
END
CAR DEALER_COST
---- -------------
ALFA ROMEO 16,235
AUDI 5,063
BMW 49,500
DATSUN 2,626
JAGUAR 18,621
JENSEN 14,940
MASERATI 25,000
PEUGEOT 4,631
TOYOTA 2,886
TRIUMPH 4,292
RODNEY
----------------------------
MINDCOST 0
-----------------------------
What if i still wanted to show 2,626 as the MIN and exclude the NULL?