Business Objects, Crystal Reports, 11 (XI)

I am familiar with the Previous() command and PreviousValue() commands in Crystal but i need to refer to a formula field in the previous record. They will not allow me to do this and give me the error "this field has no previous or next value" ... How do i do this?
Tom_cfglendingAsked:
Who is Participating?
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
The problem is probably due to {@MidTotal}
If it uses any aggregate functions, the formula becomes a second pass formula...

- Ido
0
 
peter57rCommented:
Are you sure this is not just a 'first record' problem (There is no previous record if you are on the first record).

Use

 If not Onfirstrecord then
//your current formula
else
// do nothing

0
 
Tom_cfglendingAuthor Commented:
No. I put this in:

If not Onfirstrecord then
Previous({@To Return})
else
0

and it gave me the same error
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
peter57rCommented:
Then you will have to post your formula code.
0
 
Tom_cfglendingAuthor Commented:
So there is no way to call a previous formula field?
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Post your formula ({@To Return}) expression.

It's probably a WhilePrintingRecords; formula or a formula with some aggregate function.
Such formulas are not candidates for a Previous() function.

- Ido
0
 
Tom_cfglendingAuthor Commented:

This is {@To Return}
{@MidBalance}+{@Draw 2 Live}

This is {@MidBalance}
if {Draws_Payable.Draw Amt}-{Final_Pd_Comission_Totals.SumOfSumOfCommission Rec}>0 then {Draws_Payable.Draw Amt}-{Final_Pd_Comission_Totals.SumOfSumOfCommission Rec} else 0


This is {@Draw 2 Live}
if GroupName ({Current_Employees_To_Pay.Officername})={Draw_2_Live.OfficerName} and {@MidTotal}<750 then (750-{Draw_2_Live.Difference})-{@MidTotal}
0
 
frodomanCommented:
Hi Tom,

If you cannot refer to the previous function for looking at this formula, you may be able to deal with it by setting a shared variable.  Within your formula set a shared variable to the formula result.  This variable will then be available on the next record until it is set again.

If you need to refer to the previous value within the same formula that sets it, make sure you capture the value for your comparison before setting it to the new value.  If it is different formulas use the EvaluateAfter() keyword to make sure your comparison formula is run before the formula that sets the value.

hth

frodoman
0
 
Tom_cfglendingAuthor Commented:
frodoman, I kind of understand what your saying...but i've never used variables in crystal could you give me an example? the field i'm trying to refer to is {@To Return}
0
 
Tom_cfglendingAuthor Commented:
Ok I got it working...Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.