Home RAP

Calculating percentage in footer of two other variables

edited January 2010 in RAP
I have 2 variables (TotProstate, TotNonProstate) in a group footer that
accumulate totals based on variables in the detail band (isProstate,
isNotProstate). I am trying to calculate what the percentage TotProstate is
compared to the total of both (TotProstate, TotNonProstate). Here is what I
am trying to do:

Value:= (TotProstate / (TotProstate + TotNotProstate)) * 100

However, I am ending up with 0%, even though the TotProstate and
TotNotProstate clearly have values the print in the group footer.

I am using a CalcType of veDataPipelineTraversal for everything, reseting on
veGroupEnd. This is with ReportBuilder 10.09. Any ideas?

Comments

  • edited January 2010
    Hi Tim,

    The problem is most likely the calc order in which the variables are
    calculated. You need to be sure the TotProstate and TotNotProstate
    variables are calculated before you try to use their values in another
    calculation. You can alter the calc order by selecting "Calc Order" from
    the band popup menu (right click).

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    I've actually tried changing the calulation order to after the Total
    Variables (and also before just to look for a solution), but the results
    remain at 0.. Any other thoughts?

    Thanks,
    Tim


  • edited January 2010
    Hi Tim,

    In my quick testing with the DBDEMOS database and RB 11.07, this worked as
    expected.

    http://www.digital-metaphors.com/tips/VariableCalculations.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2010
    I just downloaded 11.07 - I'll install it and see if that fixes the issue.
    If not, I'll check the demo to see what is different..

    Thanks,
    Tim

  • edited January 2010
    RB 11.07 did not make any difference. I checked the code for
    VariableCaculations and noticed that the variables were referenced by
    "variable.value" not just "variable". I made that change and the variable
    worked correctly. Thanks for your help..

    Tim

This discussion has been closed.