Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 36258
  • Last Modified:

Passing Crystal Reports Parameter to subreport filter

I have a crystal report with two subreports.  The subreports are different summaries of the numbers shown on the main report (i.e. should be looking at the exact same data).  One of the parameters on the main report is 'Branch', a list of cities where the user picks one which is then used with an 'if' statement in the main report to filter a list of delivery routes (Chicago branch = routes 3,4,7; New york Branch = routes 1,12,19,45,47; etc).  

I need to use that same filter on the subreport but can't get it to see that 'Branch' parameter so I can do the same 'if' in the subreport's filter.  As 'Branch' doesn't really exist in the data, I can't use the normal subreport link to get it that way.  

I can get the subreports to see the 'Branch' parameter to display it using a formula fild such as:

WhilePrintingRecords;
Shared stringvar MyBranch;
MyBranch

but in the select expert it errors on the 'while printing...' line, and yells at me about using a shared variable.  I can set it up without the shared, but then it thinks it is defining a new variable and the Branch sting is empty.

Any thoughts?
0
baytowel
Asked:
baytowel
  • 2
1 Solution
 
frodomanCommented:
The best process here is to create a Branch parameter *in your subreport* and use that in your Select Expert just like you do in the main report.  Rt-click on the subreport and choose 'Change Subreport Links' and you'll be able to link the parameter in the main report to the one in the subreport (so your user doesn't have to answer two parameter prompts).

Shouldn't be any more to it than that, but let me know if you need further assistance.
0
 
baytowelAuthor Commented:
Thanks, Frodoman.  

That did the trick.  Awesome - I appreciate the help!
0
 
frodomanCommented:
Glad to help.
0
 
anson2008Commented:
While using subreport in crystalreport VB2005 I am using subreport links for filtering the data based on the main report. But in my home PC its always asking the parameter value while running but its working fine in office PC

is there is any solution for it

thanks in advance
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now