Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing Criteria to Subreports Post Reply Post New Topic
Author Message
AngryLarry
Newbie
Newbie
Avatar

Joined: 13 Dec 2012
Location: United States
Online Status: Offline
Posts: 4
Quote AngryLarry Replybullet Topic: Passing Criteria to Subreports
    Posted: 13 Feb 2013 at 9:01am
I have a report that lists the attendance of a child.  Each page is the attendance for one class only.  Page two is that student's next class (or next student's first class).

I created a subreport that lists the notes that were entered for the child into our database.  These notes will be the back side on the child's class attendance report.  The notes have no physical association to a specific class.  The notes are just generically listed in the child's record in the database. 

To circumvent this issue we are using a 3 letter coding system in the note's title field to specify the class the note is for.  For example our Speech Group class is entered as "SPG".

Page one is grouped by the class (course table, coursetype field), then teacher, then student.  Data is displayed in the group footer for the student.  Obviously I cannot tell the subreport to print the notes for this class only because notes have to association to classes in our database. 

I can set up a formula to translate the class' name to the 3 letter code we use, but how do I get the main report to inform the subreport which class is being printed?

Thanks in advance for the help!  Hope I was clear enough. Ouch
Thanks!
Larry
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 14 Feb 2013 at 2:30am
Hi

You can exchange information between main report and sub report using Shared  Variables.

Ex: create a formula in subreport and place it in the report

Whileprintingrecords;
Shared Stringvar :="ABC"

Now in Main report create a formula :


Whileprintingrecords;
Shared Stringvar;

It will print ABC in your main report.
Thanks,
Sastry
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Feb 2013 at 4:06am
you can also use the class code formula in the main report as a link to the sub report. in the link set it to link to the note title field in the sub report. I also assume you will need to link on the student's ID number.
when you look in the subreport select statement you will see the two criteria there with the linked fields as parameters.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.