Print Page | Close Window

Use Link parameter in subreport SQL command?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11475
Printed Date: 01 May 2024 at 9:09pm


Topic: Use Link parameter in subreport SQL command?
Posted By: Titus
Subject: Use Link parameter in subreport SQL command?
Date Posted: 20 Oct 2010 at 7:49am
I am trying to modify a Crystal Report to speed it up.  The report has several subqueries and I could speed them up if I can include the link parameter value in the SQL query.
 
The SQL command window/editor shows the begin and end date parameters defined in the subreport but does not list the link parameter.  I tried using the {?Pm-command.ID_NUM} parameter in the SQL even though it wasn't listed, but got a SQL error from that.
 
I tried creating a parameter IDNUM and setting the default value to the link parameter value, but that didn't work either.
 
Is it possible to pass a value from the main report to a subreport and have that value included as a parameter in a SQL command?
 
If so, how do I do that?
 
I am using Crystal Reports XI. (not R2)
 
Thanks for any help anyone can provide, even if it just to confirm that it can't be done.



Replies:
Posted By: hilfy
Date Posted: 22 Oct 2010 at 5:07am

I'm not sure whether this will work, but it's worth a try.

1.  Make note of the exact names of your link parameter(s).  Then delete all links.
 
2.  In your command, create parameters with the same names as the link parameters that you deleted.  Use these in the where clause in your subqueries.
 
3.  Recreate the links from the main report.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: Titus
Date Posted: 18 Feb 2011 at 7:05am

hilfy,

Sorry it took me so long to get back.  I tried this, but it didn't work.  Then I got dragged off on another project and when I came back I didn't have time to play around with this anymore.  Since the report was working and not taking TOO long to run, I applied the "if it ain't broke, don't fix it rule" and moved on.
 
I recently had a chance to tinker with trying to get this to work on a simple scratch build report designed to try to get this to work.  I tried this and a couple of variations, but could not get it to work.
 
If I had my druthers, I would be using stored procedures and packages to generate the data for these more complex reports.  But that is not currently an option.
 
Thanks.



Print Page | Close Window