Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

RAP LookAhead Calculation

edited December 2006 in RAP
Hey folks -

Here is what I'm trying to accomplish:

Report:

Sales COGS GP Margin GP % % Sales Inv Value % Inv
Dept1 $ x.xx $ x.xx $ x.xx xx.x% var2 $ x.xx var3
Dept2 $ x.xx $ x.xx $ x.xx xx.x% var2 $ x.xx var3
Dept3 $ x.xx $ x.xx $ x.xx xx.x% var2 $ x.xx var3
Dept4 $ x.xx $ x.xx $ x.xx xx.x% var2 $ x.xx var3
Dept5 $ x.xx $ x.xx $ x.xx xx.x% var2 $ x.xx var3
---------------------------------------------------------------
sum(x.xx)sum(x.xx) sum(x.xx) var1 100% sum(x.xx) 100%
(dbcalc1)(dbcalc2) (dbcalc3) (dbcalc4)

I have the x.xx calcing in the SQL that runs without any issue.
I have the sum(x.xx) calcing on the report with DBCalcs set to sum the
(x.xx) accordingly, without issue.
I have var1 calcing based on sum(GP margin) / sum(sales) without issue.

The problem I'm having is in Var2 and Var3.

Var2 is the sales amount from the correspondind dept / sum(sales) & Var3
is the inv value amount / sum (inv value).

I can't get these to calculate correctly.

When I do NOT have the lookahead set, they all calc to 0. The
calculation in rap is:

Variable2
Value := (invparts['Extended Price'] / DBCalc1.Value) * 100;

Variable3
Value := (invparts['Current Inventory Value'] / DBCalc4.Value) * 100;

When LookAhead is checked, they all calc to the last departments (in the
example, dept 5) value.

For example, Dept 5 Sales = 60,193.39 with a total sales of 1,826,579.39
& Dept 5 Inventory = 175,762.55 with a total inventory of 4,597,892.99,
for a 3.3% and a 3.82% respectively.

The problem is that Var2 for EVERY LINE = 3.3%, even though only Dept5
is acutally that percentage. Var3 = 3.82 on each line, even though only
Dept5 is acutally that percentage.

How do I set these variables up so that the numbers are correct on each
line.

Please note that there are no grouings currently set up in the report
(the SQL is doing the groupings automatically).

thank you in advance -

Chris Kiraly

Comments

  • edited December 2006
    Hi Chris,

    The problem is the DBCalc components. As a rule of thumb, it is never a
    good idea to use DBCalc values in another calculation. The timing in which
    a DBCalc gets its value differs from the TppVariable. I would recommend
    replacing all your DBCalc components with TppVariables and performing the
    calculations manually. Then use only TppVariables in your calculations for
    Var2 and Var3.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.