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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group Selection Dilema 1

Status
Not open for further replies.

rtrek

Programmer
Aug 6, 2002
21
0
0
US
I have a database with a one to many relationship of a student record to many activity records. I am grouping on the student id of the student record. I only want the student to print if there is not a specific value any of the activity records.

IE, if any of the activity records have an "ENRL" in the activity code, do not select the student to print.

Thanks for the help.
 
Hi !

If I get you wright you want to ignore a student completely if he/she have many activity records but at least one of them have activity code = 'ENRL'.

If so I have a suggestion even if it maybe a little confusing.

1. Create a formula @SortOrder
if {table.activitycode} = "ENRL" then
1
else
2


2. Put the @SortOrder-formula in your DetailSection and suppress the field.

3. Now sort your report using the above formula (ascending)

4. Create another formula @Status_Ignore
booleanVar Ignore;

If OnFirstRecord then
if {table.activitycode} = "ENRL" then
Ignore := Yes
else
Ignore := No
else
If previous({table.activitycode}) <> {table.activitycode} then
if {table.activitycode} = &quot;ENRL&quot; then
Ignore := Yes
else
Ignore := No
else
Ignore


4. Put the @Status_Ignore-formula in your DetailSection and suppress the field.

5. Now it´s time to conditionally suppress your sections.
Right click the sections to the left, choose format section and click on the &quot;X+2-button&quot; to the right of the &quot;suppress-text&quot; and write this formula in both the Detail, GroupHeader and GroupFooter section:

if {@Status_Ignore} = Yes then
true


Maybe there is a better way to do it, but I think it will work.

/Goran
 
Thanks for the help. Your basic idea worked although I had to modify it slightly for my specific application. And this is going to help me on something else I need to finish up also.
 
I think for #4 you can just place the following formula in the group header:

global boolean Ignore;
if {table.activitycode} <> &quot;ENRL&quot; then
Ignore := true

Now place the following in the detail section suppression:

global boolean Ignore;
Ignore

-k kai@informeddatadecisions.com
 
Here is a somewhat simpler approach:

1. Create a formula {@Is_Enrl}:
----------------------------------
IF {table.activitycode} = &quot;ENRL&quot; then 1 ELSE 0
----------------------------------

2. In the Suppress attribute for the Student sections
use the following expression:
---------------------------------
Sum ({@Is_Enrl}, {student_id})>0
---------------------------------

Cheers,
- Ido CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top