cancel
Showing results for 
Search instead for 
Did you mean: 

Need help linking shared variable to subreport paramter

Former Member
0 Kudos

I have two subreports that are displayed on my main report.  The first subreport assigns a value to a shared variable from one of the fields that is returned from the subreport's stored procedure.  I'm able to successfully display that shared variable value on the main report.  I added a second subreport that to a section beneath the first subreport that will use the shared variable value as a parameter input.  I haven't been able to get the second subreport to use the shared variable value to return any data.

Here is what I've tried so far:

Clicked "change subreport links" on the second subreport

moved the main page shared variable formula to the "fields to link to" pane.

Selected the second subreport stored procedure parameter name in the "subreport parameter field to use" section.

The checkbox to the right is greyed out.

Can anyone offer any advice on what I'm doing wrong?  Is there an easier way to populate a subreport from a field that is returned in another section? 

I'm using Crystal 10, thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Fred,

Hope, you have placed the main report shared variable formula atleast one section above the section where subreport # 2 is placed.

Also you might be aware that the datatype and format of the 'value' going from shared variable formula to subreport # 2's stored proc parameter should be matching.

You can test if the shared variable is actually passing any value to the subreport # 2 or not, by simply calling it in a formula inside subreport # 2.

Thanks,

Prathamesh

abhilash_kumar
Active Contributor
0 Kudos

Well, if you see the parameter from the subreport's source under "Subreport parameter fields to use", that usually means that the datatype of this parameter and field in the "Fields to link to" pane are same!

If the datatypes don't match, CR does not show the parameter in the drop-down.

-Abhilash

Former Member
0 Kudos

Yes, I can see the parameter from the subreport's source.  The forumula has NumberVar and the stored procedure parameter has an Int type.   I'm not sure why the subreports is not being displayed.  I did not that the forumla return 23.00 instead of 23 but I don't think that should be a problem?

I can see the forumla value if I drag the formula into the the section before or the section with the subreport.  I believe something is wrong with the way I have the parameter linked.

abhilash_kumar
Active Contributor
0 Kudos

Hi Fred,

Could you create a new report using the sub-reports's datasource and use 23 as the parameter value when it prompts? Does the report return any results?

-Abhilash

Former Member
0 Kudos

Yes, it works fine.  Are you allowed to use shared variables as subreport parameters?  Is there another option?

abhilash_kumar
Active Contributor
0 Kudos

OK. Looks like that's what the issue is.

Seems that you cannot link a shared variable to a subreport's parameter.

-Abhilash

Former Member
0 Kudos

Well, if thats really true then I still can't believe it,since I don't see any logic why this shouldn't work.

Abhilash, can we consult the concerned group about this.

Thanks,

Prathamesh

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Fred,

You should be able to link to a parameter in another Subreport using the shared variable without any issues.

You said that you were able to move the shared variable to fields to link to pane and also select the stored proc's parameter from the drop-down list. What happens after this? Doesn't the second subreport return data respective to the shared variable's value?

What you're following is the correct way to do it, in fact if you've linked the shared variable to the subreport's parameter so the subreport should return something.

-Abhilash