Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In Crystal XI .. can't get formula to work right. 1

Status
Not open for further replies.

kratz

Programmer
Nov 17, 2006
35
US
Report has detail plus two group levels.
My formula concatenates string values from detail level such that at the end it contains every value from the column in a single string.
It is working absolutely perfectly ... only on the detail lines.
Problem is, the formula evaluates again between the last detail line and the group line.
In other words, if the column value in the final detail row = XYZ then on the group level the formula shows XYZ twice.

FELARR FELARR
JD FELARR,JD
MISARR FELARR,JD,MISARR
OPENJD FELARR,JD,MISARR,OPENJD
FELARR,JD,MISARR,OPENJD,OPENJD
FELARR FELARR
FINAL FELARR,FINAL
JD FELARR,FINAL,JD
JDADJ FELARR,FINAL,JD,JDADJ
MISARR FELARR,FINAL,JD,JDADJ,MISARR
VFO FELARR,FINAL,JD,JDADJ,MISARR,VFO
FELARR,FINAL,JD,JDADJ,MISARR,VFO,VFO

Above is an illustration of detail rows and group row of the inner group.
 
Oh, and here's my formula:

StringVar statusCodes;
//WhilePrintingRecords;
if OnFirstRecord then statusCodes:={Command.CYCLE_HISTORY_STATUS_CODE}
else
if //(not OnFirstRecord) and
{Command.CRIMINAL_CYCLE_ID} <> previous({Command.CRIMINAL_CYCLE_ID})
then statusCodes:={Command.CYCLE_HISTORY_STATUS_CODE}
else
if //{Command.PERSON_ID} = previous({Command.PERSON_ID}) and
{Command.CYCLE_HISTORY_STATUS_CODE}<>previous({Command.CYCLE_HISTORY_STATUS_CODE})
then statusCodes:=statusCodes &", "& {Command.CYCLE_HISTORY_STATUS_CODE}
;
statusCodes
 
You need to have whileprintingrecords at the beginning of the formula (not commented out), and for the display in the group footer, you must use a separate formula that just references the variable. Be sure to remove the earlier copy of the accumulation formula.

whileprintingrecords;
StringVar statusCodes;

You could use a reset formula in the group header instead of all the language checking previous records.

whileprintingrecords;
StringVar statusCodes;
If not inrepeatedgroupheader then
statusCodes := "";

Your accumulation formula (detail section only) could then just be:

WhilePrintingRecords;
StringVar statusCodes;
if not({Command.CYCLE_HISTORY_STATUS_CODE} in statusCodes ) then //to get unique values only
statusCodes:=statusCodes &", "& {Command.CYCLE_HISTORY_STATUS_CODE}
;

Not sure what your groups are or at which group level you want the reset, but the reset and the display formula belong in the same group, in the header and footer respectively.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top