Print Page | Close Window

Variable in Group header

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=5026
Printed Date: 01 May 2024 at 7:17pm


Topic: Variable in Group header
Posted By: nelsont
Subject: Variable in Group header
Date Posted: 16 Dec 2008 at 6:51am
A question that is puzzling me -
 
We have a report that we wish to alter by changing the messages that print when certain criteria are met.  In general, an employee may have 1, 2 or 3 plans associated with him. 
 
When 1 plan is present, there is not a problem with printing the plan message after the plan ID.
 
When 2 or 3 plans are present, we would like to print the plan IDs, and then print all of the messages (2 or 3 different pieces of data).
 
We can't get all 2 or 3 messages to print.  Only the last  message will print.  We can get the message to print if we include it after the specific plan (change the print order), but we don't want to setup the report this way.Thumbs%20Down
 
I have the report set up as:
 
Page Header
         [Info]
Group Header 1
         [employee name and information]
Group Header 2
         [Plan 1]
         [Plan 2 - if present]
         [Plan 3 - if present]
         [Plan 1 message]
         [Plan 2 message - if present]
         [Plan 3 message - if present]
Group Footer 2
         [empty]
Group Footer 1
         [general information to employee]
Page Footer
         [Info]
 
Thanks in advance for any help.



Replies:
Posted By: lockwelle
Date Posted: 16 Dec 2008 at 6:56am
I am guessing that the message is in a formula.  I would concatenate the messages together.   It sounds like the formula is an if statement and is only printing the last message, which is why I thought to concatenate.  You would need to set the field to grow so that all lines can be viewed (if space wasn't allotted for that)
 
Only other thought, since it isn't mentioned is that the group interfers with the message.
 
These are my first thoughts...
Hope they help in some small way.


Posted By: nelsont
Date Posted: 16 Dec 2008 at 10:20am
Thanks for the feedback.
 
Yes, the message is in a formula.  I don't think that I can concatenate the messages because each time through the detail, the plan (and message) may change.  I cannot understand how to get a message(s) to "stick" for all details to be read.  And then to reset it for the first reading of a new employee.
 
I did leave out one important (potentially) component.  The details section, which is between the header & footer is suppressed.


Posted By: lockwelle
Date Posted: 16 Dec 2008 at 10:26am
Suppressed is OK.  To get the message to 'stick'
 
in the formula for the message at the top:
Shared StringVar msg;
 
In the formula, where you decide which message to display, instead of something like "Message" make it msg := msg + "Message"
 
The display formula is simply: Shared StringVar msg
and in the group header 1 set the msg := "" to reset it.
 
Does this help?


Posted By: nelsont
Date Posted: 16 Dec 2008 at 12:29pm
I am still having an issue with the msg only displaying text based on the last Plan included for the employee.
 
In the Group Header 1, to reset the msg, I have:
Shared StringVar msg;
msg := ""
 
In the Group Footer 1, to print the messages, I have:
Shared StringVar msg;
IF {PlanID} <> 'HRA'
then msg := msg +
     'message for non-HRA'
else msg := msg +
     'message for HRA'
 
There are only 2 plans in this example, to attempt to get the deal working - then I'll add the 3rd plan.
 
I can try to post actual code, if that will help any.
 
Thanks.


Posted By: lockwelle
Date Posted: 16 Dec 2008 at 12:59pm
I think you want what is in the footer to be in Group Header 2, then display the result in Group Footer 1
 
Does that make sense?  You want to loop through any plans and update the variable, then display it.


Posted By: nelsont
Date Posted: 18 Dec 2008 at 5:39am
Thanks for the assistance.  I believe that I now have what I need - thanks to the Shared msg info.



Print Page | Close Window