Probably very basic, but...

Printed From: Crystal Reports Book — Forum Name: Technical Questions

I want to create a simple "and" statement. I only want to see students who took "class a" AND "class b", not OR (which is what i get when i use the "is one of" option in the select expert). Who can help me??
In the select expert, you can choose one of the pre-defined options, or you may choose to write your own custom formula and use it.

In your formula, you can write just that.

{table.field} AND {table.otherfield}

This will display all records that satisfy the condition.
I am not sure which version you use, but you can do this in the select expert window as well as the formula editor.
i think the issue is that Class A and Class B are on differnt rows.
If you need a crystal only solution, group on student
create two 'flag formulas'
flag_class_a
if classfield="A" then 1
flag_class_b
if classfield="B" then 1
Sum both of these at the student group level
in the select expert use the group select option and use your criteria here
SUM(flag_class_a,student)>0 and SUM(flag_class_b,student)>0
 
Group selection criteria occurs after the report is built so all students will appear in the group tree but only students that meet your criteria will appear in the report
thanks, but this doesn't work. First there is no "pre-defined option" for creating an AND statement in Crystal 11. They all behave as "OR" statements, pulling any data that matches the selection.
 
As far as the AND example you provide, that doens't work either, as "table_field" is the same for both values i want pull ("class.course_code").
 
I'll give the provided below a try, if I can figure out exactly what he's talking about.
thanks, i'll give this a try, although i'm not fully versed on formulas yet.
Originally posted by barrymac1


As far as the AND example you provide, that doens't work either, as "table_field" is the same for both values i want pull ("class.course_code").


1: I am assuming if a student is in class A and in class B, then two records will appear for that student, where the only difference is the value of class.course_code.

The flag example should work because if you were to group the records by student, then all of the records for a particular group will be the classes that the student is enrolled in.

Flag A will = 1 if the student has taken class A. And flag B will = 1 if the student has taken class B.

Your group filter will show all groups where both these flags are > 1 for the particular group (ie: student)

Edited by Keikoku - 03 Feb 2011 at 10:08am