Solved

Passing parameter values from main report to subreport

Posted on 2003-10-21
8
1,090 Views
Last Modified: 2007-12-19
I have an unlinked subreport that needs the same parameter values as the main report at runtime. I have tried using shared variables and the values seem to get passed to the subreport OK. However the shared variables are not available to be selected in the formula editor when I am using the selection expert for the subreport.

Any suggestions? Thanks
0
Comment
Question by:slimchance99
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9593693
I haven't used variables very much.  Are local variables available in the select expert?

How are you calling the reports?

mlmcc
0
 
LVL 7

Expert Comment

by:ladylinet
ID: 9594064
Check your declaration for shared variables (this is Basic syntax, Crystal one is similar):

WhilePrintingRecords
Shared intCounter As Number
formula = intCounter

 mlmcc, shared variables are not same as local variables - they are shared between main report and subreport;and  they have to be declared on both places...

Lady Linet
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9595906
I know the difference between shared and local but I haven't had reason to use them so I was wondering if local variables were available in the select expert.

mlmcc
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:slimchance99
ID: 9598266
The shared variable is declared in both the main report and the subreport. The value is getting passed from the main to the subreport OK. The shared variable is not available as a report object in the Select Expert though. How can I use the value of the variable to select records in the unlinked subreport?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9603591
If it isn't available in the select expert, is it available to a formula?  You could create a formula that just returns the value and maybe use the formula in the select expert.

mlmcc
0
 

Author Comment

by:slimchance99
ID: 9607244
It is already a formula - the formula is not availabe in the select expert, even though the formula exists in the subreport

slimchance99
0
 

Accepted Solution

by:
Max88Can earned 125 total points
ID: 9607651
I may have misunderstood the problem but to me I would recreate the same parameters that are in the main report in the subreport and then use the edit subreport links to join the specific parameters together (making sure that the "Select data in subreport" checkbox is not checked).  The new parameters in the subreport will be available to the select expert and formulas.  

If some these parameter values have to be manipulated and brought back to the main report then that is when I would use shared variables.

0
 

Author Comment

by:slimchance99
ID: 9608641
Perfect! That is exactly what I needed. sometimes it's too easy to look for the complicated solution when a simple on will do.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question