Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Question on passing RecordSelection to subreports Post Reply Post New Topic
Author Message
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Topic: Question on passing RecordSelection to subreports
     Posted: 21 Feb 2011 at 6:14am
Hello,
 
I have a report that has a subreport inside of it.  This report is displayed inside of another appliction that will change the record selection formula at runtime.  It does not, however, pass this to the subreports.
 
What I am trying to do is this:
 
1) Create a formula field: Name = strRecSelect Value = RecordSelection
2) Pass this, as a parameter to the Sub-Report
3) Have the sub-report use the new record selection formula as well as the parameter passed value.
 
I have done 1 and 2, but when I do this in the Formula Workshop:
 
if ISNULL({?Pm-@strRecSelect}) then
    TRUE
Else
 
It just tells me that I have to have a boolean value there.
 
Any help that anyone can provide would be greatly appreciated and I thank you in advance for any help that you can provide.


Edited by Anubisascends - 21 Feb 2011 at 6:15am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 21 Feb 2011 at 7:46am
Unfortunately, you can't do it this way.  Either the record selection has to be set for the subreport or you have to be able to link from the main report to the subreport in such a way that only the records selected in the main report are reflected in the subreport.
 
How are you currently linking the main report to the subreport?  What is the purpose of the subreport in relation to the main report?
 
-Dell
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 21 Feb 2011 at 7:56am
Thanks for you response, even if it wasn't what I was hoping for, lol.
 
Well, the sub-report displays a 'Cross-Tab' report.  This report is created for manufacturing shops.  It displays a list of parts (sorted by Length, then Width) and below, for each material, it displays a 'rip' summary.
 
This rip summary displays each unique 'width' value and calculates the number of 'rip cuts' necessary to get the parts created.
 
Using a subreport was the only way that I could, reliably, create a cross-tab report to display the values I needed (read: the only way I could figure it out)
 
If you need, I can post more information on the databases and the report layout.
 
Thanks again.
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 21 Feb 2011 at 9:36am
Just for reference, this is how the databases are setup:
 
Material - Access Database
 
tbl_Material
-----------------------
ID
Name
Description
Thickness
etc.
 
tbl_Parts
-----------------------
ID
Name
Description
etc.
 
Report - Access Database
 
Objects
-----------------------
ID
Width
Height
Depth
etc.
 
Parts
------------------------
Part ID | References [tbl_Parts].[ID] in Material database
ObjectID | References the [Objects].[ID] field
Width
Width String
Length
Length String
MaterialID | References [tbl_Material].[ID] in Material database
Description | Used incase part description should be different than [tbl_Parts].[Description]
etc.
 
The report is laid out as such:
 
Group 1 - [tbl_Material].[ID]
Group 2 - [Parts].[Width]
Group 3 - [Parts].[Length]
Group 4 - [Parts].[Description]
Group 5 - [Parts].[ObjectID]
 
The sub-report is contained in Group Footer 1.  This is so that the cross-tab reports on a per material basis.  Now the filter that is created will filter out objects based on their ID.  Since the sub-report is in Group Footer 1, this misses out the normal filtering
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 21 Feb 2011 at 10:55am
Are you using parameters for the main report or is the calling application directly setting the selection criteria?
 
-Dell
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 22 Feb 2011 at 5:02am
It is directly setting the selection criteria.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 22 Feb 2011 at 5:10am

There are only two ways I can see to get this to work:

1.  Have the code modified to also set the selection criteria in the subreport.
 
2.  Change the report to use parameters and have the code set the parameters instead of setting the selection criteria.
 
-Dell
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 23 Feb 2011 at 7:18am
I convinced the programmers to pass the record selection formula to the sub-reports based on a switch that exists in the database.

Thanks for your help.
IP IP Logged
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