Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with using formula in running total

I'm using Crystal Reports v10 and I'm running into an issue with using formulas in a running total. I've done this same procedure in a previous report and the report allowed it which is why I can't understand why it won't work now.

The report starts off with 5 formulas with 4 being calculated off the first formula.

The first formula is called currWarrBaseYrPrc and it contains the following code:

currencyVar warrBaseYrPrc := 0;

if ((not isnull({VI_PS_TKT_HIST_LIN.PRC_1}) and {VI_PS_TKT_HIST_LIN.PRC_1} = 0 or isnull({VI_PS_TKT_HIST_LIN.PRC_1})) and not isnull({VI_PS_TKT_HIST_LIN.PRC})) then

    warrBaseYrPrc := {VI_PS_TKT_HIST_LIN.PRC} * {@Warranty%} * {VI_PS_TKT_HIST_LIN.QTY_SOLD}

else if (not isnull({VI_PS_TKT_HIST_LIN.PRC_1}) and {VI_PS_TKT_HIST_LIN.PRC_1} <> 0) then

    warrBaseYrPrc := {VI_PS_TKT_HIST_LIN.PRC_1} * {@Warranty%} * {VI_PS_TKT_HIST_LIN.QTY_SOLD}

else

    warrBaseYrPrc := 0;

warrBaseYrPrc;

The other formulas are calculated based off this formula as shown below:

currWarr2YrPrc:

currencyVar warrBaseYrPrc;

if ({@IsYear1Included?}) then

    warrBaseYrPrc * {@Warranty%Increase}

else

    warrBaseYrPrc;

currWarr3YrPrc:

{@currWarr2YrPrc} * ({@Warranty%Increase});

currWarr4YrPrc:

{@currWarr3YrPrc} * ({@Warranty%Increase});

currWarr5YrPrc:


{@currWarr4YrPrc} * ({@Warranty%Increase});

@Warranty% and @Warranty%Increase are calculated based on parameters as shown:

Warranty%

{?Warranty %} / 100.0

Warranty%Increase

(1 + {?Warranty % Increase} / 100.0)

@IsYear1Included?

if ({?Year 1 Included?} = false) then

    true

else

    false

All these formulas are in the same two sections of the report Group Header 2c and 2d. I want to do a running total on each of the "Warr" formulas in Group Footer 1f but, for some reason, I can only put @currWarrBaseYrPrc in a running total and all the other ones aren't accessible for the field to summarize.

I'm not sure why because I implemented this design before in a different report with no parameters without issue. Can someone identify what I'm doing wrong?

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question