Crystal Reports Groups

I have attached a rpt to look at.
1. Page 6 - If the client has only 1 page, it should hide 'Allergies: See Allergy Infor on first page".

2. Page 10 - If the client has No known Allergies , it should hide the first "Allergies: No known allergies"

Who is Participating?
James0628Connect With a Mentor Commented:
For #2, if "the client has No known Allergies" means that there is at least one record for ClientDisplayName where Code is "No Known Allergies", or where AllergyDeclarationType is 2, then you could use a formula to count those records and suppress that field, or the GH2 section, based on that formula.  For example, create a formula like this:

if {hsp_eMARDowntime.AllergyDeclarationType} = 2 then

 Then you could use this to suppress the field/section:

Sum ({formula above}, {hsp_eMARDowntime.ClientDisplayName}) > 0

 As for #1:
 The "client" is group 2 (ClientDisplayName), correct?
 If the report was formatted in a very structured way, then you might be able to tell from something like the number of records in the group how many pages it was going to be, but your report doesn't seem to be like that.  I don't think that you'll be able to tell in the group 2 header how many pages the group will be.  But do you really need to?

 You say that you want to hide "Allergies: See allergy info on first page" if the client has only one page, but even if they have more than one page, showing that on the first page wouldn't seem to make sense.  So, maybe you just want to hide that message on the first page for a client, no matter how many pages they have.  That you could theoretically do.

 The basic idea would be to add a new GH2 section above the current one, use a formula in the new section to reset a variable, then check that variable in the current GH2 section and if it hasn't been set yet, suppress that message (either the field or the whole section), and set the variable.  Then the second time that the old GH2 section comes up, the variable will have been set, so the message is displayed.

 An added complication is that you have group 2 set to repeat the group header on each page and you're using (not InRepeatedGroupHeader) to suppress GH2, so you'd have to take that into account, but I think it could be done.

 The question is, does suppressing that message on the first page for a client (group 2), whether the client has just one page or multiple pages, sound like it will give you what you're looking for?

 If not, can you come up with some other condition to check for, instead of "the client has only 1 page"?

mlmccConnect With a Mentor Commented:
There is no way to know the length of a group or how many pages it takes when the header is built.

This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
All Courses

From novice to tech pro — start learning today.