Hello I was wondering if anybody knew how to display the previous value from a list of values without using the previous function. Using crystal version 8. Thanks.
Use a formula (@setValue) to set a variable to the field in question. For example:
----------------------
WhilePrintingRecords;
StringVar ls_Prev_Value;
ls_Prev_Value := {your_field}
----------------------
Place that formula in Detail Section B.
In Detail Section A, use a formula (@use_Prev_Value) to declare and use the value of the variable:
----------------------
WhilePrintingRecords;
StringVar ls_Prev_Value;
IF IsNull(ls_Prev_Value) THEN
// do nothing, we are on 1st record
ELSE
// ls_Prev_Value contains the value in the previous record
// Use it in any way you like.
----------------------
hth,
- Ido
CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
Thanks IDOMillet, but could you finish the second part of the formual that you have included as //. How do you say if isnull(Is_prev_Value) do nothing. And how do you say if it is, show the previous value. Sorry, I know you were giving me an example but still not sure how to use it. Thanks again.
If all you want to do is show the previous value, then use something like:
----------------------
WhilePrintingRecords;
StringVar ls_Prev_Value;
ls_Prev_Value;
----------------------
Cheers,
- Ido
CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
It might help to know why you want to avoid using the previous function, but I don't, so whether this will be of any help is sort of a long shot, but...
If you know the relative position of the field you want to display, for example, third from the last, you could do the following:
Create a running total which counts a recurring field within a group. Then create a formula:
whileprintingrecords;
numbervar display;
if {#runningtotal} = count({table.field},{yourgroupfield})-2 then display := {yourdisplayfield} + display;
display;
This would give you the third from the last record within the group, or use -3 for fourth from the last, etc. Since it will display in each row subsequent to it, you might need to add some suppression formulas if you only want it to display in one row. For the above formula (third to the last record), if you want the previous value to appear in the second from the last row, suppress the field in the other rows in which it appears by using the following in the format field->suppress area:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.