percentages using break-sums

michiel <[email protected]> Fri, 17 Feb 2006 21:28:33 +0100
Newsgroups gmane.text.rlib.user
Message-ID <[email protected]>
Hi,

I tried calculating rowlevel percentages of a total of a break wich 
should show a result like:

#      %
3     75        
1     25
_
4

using:

<Variable name="sumnumber" value="val(q.number)" type="sum" 
resetonbreak="Maand" precalculate="yes"/>
<Variable name="sumturnaround" value="val(q.turnaround)" type="sum" 
resetonbreak="Maand" precalculate="yes"/>
<Variable name="perc_number" value="(val(q.numberl)/v.sumaantal)*100" 
type="expression" resetonbreak="Maand" />
<Variable name="perc_turnaround" 
value="(val(q.turnaround)/v.sumturnaround)*100" type="expression" 
resetonbreak="Maand" />

and showing them (q being the main query):

<field value="q.aantal" width="10" align="right" col="3"/>
<field value="val(q.turnaround)/100" width="10" align="right" 
format="'!# %.02f'" col="5"/>
<field value="v.perc_number" width="10" align="right" format="'!# 
%.01f'" col="6" />
<field value="v.perc_turnaround" width="10" align="right" format="'!# 
%.01f'" col="7" />

But see percentages > 100%...
As precalculate and delayed are not documented I'm kind of guessing and 
experimenting ;)

Can this be done with RLIB and if so how should it be done..


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642