Print Page | Close Window

data next to the last record at group header level

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19572
Printed Date: 06 May 2024 at 10:24pm


Topic: data next to the last record at group header level
Posted By: guptaa
Subject: data next to the last record at group header level
Date Posted: 23 May 2013 at 8:48am

Not sure how to print data next to the last record prints at that Group Header Level……

 

My report has 3 groups.

Group header is being used to display the information.

2nd group contains a score (number) that needs to print next to the last record prints at that level

Just can’t figure it out. Any help would be greatly appreciated.

This is the record example:

 

P1    Number of prior assigned neglect complaints and/or findings

a.        The primary worker can access relatives, friends or ............

b.     Limited or nega………………………………………………….. ..........       1

                        No or limited social support from…

               Relatives/friends/neighbors have….



-------------
Aradhana



Replies:
Posted By: hilfy
Date Posted: 23 May 2013 at 12:06pm
Please outline this a little more clearly.  Which group header does the second group score need to be in?  Are you aggregating data in the second group to get the score?  Or is this just a number from the data that needs to appear?
-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: guptaa
Date Posted: 23 May 2013 at 3:12pm
sure..Thanks for taking a look..
The example data didn't print clearly above and it needs to be looking like this:

P1     Number of prior assigned neglect complaints and/or findings
         N1    The Primary worker can access relatives, friends or..
         N2     Limited or negative......................................................   1
                  a. Yes
                  b. No

P1 is group level one, N's are group level two and "a, b" are group level three.
"1" is the score that prints next to the last record at group header 2.
It comes from the data set and not calculated in the report.

Data set looks like this:
Level1_Desc               Level2_Desc                Level3_Desc     Score
Number of prior...         The Primary worker...                              1
Number of prior...         Limited or nega             Yes
Number of prior...         Limited or nega             No 
  
Hope it is clear...please ask if not..









-------------
Aradhana


Posted By: guptaa
Date Posted: 23 May 2013 at 3:18pm
One more important thing that the score may appear with any record at group level two but always needs to print w/last record at that level.

thanks


-------------
Aradhana


Posted By: hilfy
Date Posted: 24 May 2013 at 5:15am
So, if I understand you correctly, the score can appear on any record in group 2, but you only want it to appear in the last record.  Is that correct?  If so, you'll need to use a variable with three formulas - one to initialize the variable at the beginning of the group, one to set the value, and one to display the value.  They'll look something like this:
 
{@InitScore}
WhilePrintingRecords;
NumberVar Score := 0;
 
Place this in the P1 group header.  Because there's a semi-colon at the end, the value shouldn't display.  But you need it to process as group 1 changes.
 
{@SetScore}
WhilePrintingRecords;
NumberVar Score;
If not IsNull({MyTable.Score}) Score := {MyTable.Score};
 
Place this in the N1 group header.  Again, because of the final semi-colon, the value won't display.  NOTE:  If there can be multiple records with scores and you want to add them together, change the last line to this:
 
If not IsNull({MyTable.Score}) Score := Score + {MyTable.Score};
 
{@ShowScore}
WhilePrintingRecords;
NumberVar Score;
If OnLastRecord or {MyTable. GroupP1Field} <> Next({MyTable.GroupP1Field}) then Score
 
Place this in the N1 group header as well, in the place where you want the score to appear.  It should only show the score on the last N1 record of the P1 group.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: guptaa
Date Posted: 24 May 2013 at 6:53am
Thanks so much for the details

I set all 3 formulas as mentioned.
The formula {@ShowScore} is place at N level as well
But it is printing the score on every record at N level.
This is the formula code:

WhilePrintingRecords;
NumberVar Score;
If OnLastRecord
or ({SP_IV08_FAMILY_RISK_ASSESSMENT.SORTVALUE1}) <> Next({SP_IV08_FAMILY_RISK_ASSESSMENT.SORTVALUE1})
then Score

I think it is almost there...


-------------
Aradhana


Posted By: guptaa
Date Posted: 24 May 2013 at 8:00am
It works if used as suppress formula for @ShowScore
suppress if ({SP_IV08_FAMILY_RISK_ASSESSMENT.SORTVALUE1}) = Next({SP_IV08_FAMILY_RISK_ASSESSMENT.SORTVALUE1})

but not entirely since the report has another group after N Group.
Having another group doesn't change the value of P and fails the suppress
condition where the 3rd level extsts.

We keep working and I am sure it is coming..


-------------
Aradhana



Print Page | Close Window