cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass information to subreport and main report

Former Member
0 Kudos

I have a infinite campus subreport that i need to pass information to. The information for the report is retrieved using sql. I would like to pass the studentid from the sql command on the main report to my subreport called Comments in crystal reports.

Also, Im trying to pass the current year to main report in the report card. Note: I cant use subprocedures because i dont have the privileges to create anything on the sql server.

Edited by: jeffman2 on Sep 15, 2011 7:48 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I want to just want to pass the studentid field into the sql query in my subreport. The studentid helps limit my query to that specific student in the subreport and show his comments. BTW, whats the record limit on crystal reports i cant remember if it's 3000 or 5000?

Sorry, i forget i also want to pass certain fields using the asp.net webpage sample for crystal reports to my main report. How do i that? Although this part i may not need i want to know for future reference.

Edited by: jeffman2 on Sep 15, 2011 9:04 PM

abhilash_kumar
Active Contributor
0 Kudos

Alright, so here's what you need to do:

1) In the subreport create a command object and add the query for eg:

select * from Comments where Commens.StudentID = {?StudentID}

2) If you notice the where condition of the command object, I've added a parameter called StudentID

3) While in the command object window, click on the "Create...' to create the StudentID parameter

4) Click on OK and it will prompt you enter the StudentID. Go ahead and enter a StudentID so that the command runs for the 1st time

5) Go back to the Main report and right click the Subreport > Change Subreport Links

4) Add the StudentID field to the Field to Link to area and in the 'Subreport parameter field to use:' drop-down select the StudentID parameter that we just created in the command object.

This will restrict the StudentIDs being sent to Crystal Reports.

Also, Crystal Reports can certainly fetch more than 5000 records, there is no such limit as long it isn't being used as an ETL Tool to fetch around a 100m records!

-Abhilash

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi,

Do you also wish to filter the records in the Subreport based on the StudentID?

Suppose, the Main report is grouped on StudentID, then place the Subreport either on the Group Header or Group Footer.

Right-click the subreport and select 'Change Subreport Links'. Add the StudentID field to the 'Fields to Link to' Area and check 'Select data in subreport based in field'. Select the database field in the subreport that can be linked to the StudentID from the drop-down.

You can get the current year from the Subreport to the Main report using Shared Variables.

Hope this helps!

-Abhilash