Passing Crystal Reports Parameter to subreport filter
Posted on 2006-07-17
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:
Shared stringvar 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.