Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Subreports with different parameters Post Reply Post New Topic
Author Message
Forrest23
Newbie
Newbie
Avatar

Joined: 24 Aug 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Forrest23 Replybullet Topic: Subreports with different parameters
     Posted: 24 Aug 2010 at 8:29am
I currently have a main report listing events details by categories. . I also have 2 subreports with summary information by categories.  One subreport is simply a summary of the main report, while the other subreport is a summary on LAST YEARS events.  I am trying to figure out how to allow users to enter data into a parameter to get the correct data without having to go into the "last year" subreport seperately.  Any ideas?
 
-Andrea
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 25 Aug 2010 at 12:35pm
I may have an answer for you but I need more information....
 
Do your user's enter the date for the data to show on the main report?  Is it always the current year or could it be a previous year's date an you want to also show the data from the year before that?
 
-Dell
IP IP Logged
Forrest23
Newbie
Newbie
Avatar

Joined: 24 Aug 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Forrest23 Replybullet Posted: 26 Aug 2010 at 5:34am
The main report and one subreport span the same information searched by event number (i.e. YYMM-#### to YYMM-####).  The other subreport is the same time span, searched the same way, only for the prior year so that the data can be compared year to year.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 26 Aug 2010 at 6:03am
Ok, this is not too difficult.  I'm going to assume that your event numbers are strings and that your "date" parameters are strings in the format 'YYMM'.  If they're not, this should still give you the logic that you need.
 
Working in the "Last Year" report, do the following:
 
1.  Create a formula that I'll call {@LastYearDate} that looks something like this:
 
Right('0' + ToText(ToNumber(left({table.event_number}, 2) + 1), 0), 2) + mid({table.event_number}, 3, length({table_event_number)-2)
 
This adds 1 to the year of the event number and makes sure that it has a leading '0' if the year is less than 10.  We'll use this for the link.
 
2.  Set up your subreport links - link from your start date to this formula and from your end date to this formula.  This will automatically set up the parameters in the subreport with a prefix of "PM_".
 
3.  Go to the Select Expert for the subreport.  When you set up a subreport link, Crystal creates record selection criteria with "=".  Modify the selection criteria so that your formula is >= the start parameter and <= the end parameter.
 
-Dell


Edited by hilfy - 26 Aug 2010 at 6:03am
IP IP Logged
Forrest23
Newbie
Newbie
Avatar

Joined: 24 Aug 2010
Location: United States
Online Status: Offline
Posts: 3
Quote Forrest23 Replybullet Posted: 26 Aug 2010 at 7:27am
I wish I could say it worked like a charm, but I kept getting error messages. . . it kept asking for a string in place of the +1.  This is what my selection formula looks like right now:
{V_CASEManagement.CASE_Case_Number} in "0808-10181" to "0907-12152"
 
I am not currently using a parameter.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 26 Aug 2010 at 10:20am
Please post exactly what you've typed in so that I can see what's happening.
 
Thanks!
 
-Dell
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