Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Main to Subreport Command Object Parameter

Status
Not open for further replies.

jbarbato

Programmer
Apr 6, 2005
56
US
Hi there! I am using Crystal Reports XI with Oracle 10g DB...

I would like to know how to pass in a field from a main report and use it in the command object of a subreport as a parameter.

I am building a tree with SQL from the DB inside the subreport command object, so I need to filter the data as the tree is being made in the command object, not after in the select expert.

Thanks!
- Jayme

 
I don't have Oracle and use Crystal 10. But since no one else has answered you, I'll have a go.

Sending the subreport a parameter (or any other value) is simply a matter of Edit > Subreport Links. It will expect to find something to link to and will generate a selection statement in the subreport's report selection. But this can be changed or removed when it is not what you want.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Yes this part I understand...

The trouble is, I need to do my filtering before I build my tree using the connect by statement in the command object. So my parameters are listed inside of the command object. Once I build this tree, I am trying to link it to the main report.

Since I have my parameters inside the command object, they are not listed in the options available to link to in the subreport.
 
Actually, they should be listed. If the command object is used for the subreport, in the edit subreport links screen, go to the bottom left and use the dropdown to see your command parameter in the subreport.

What you probably need to do is develop the same type of parameter in both main and subreport and then link, using the dropdown value for the subreport parameter, not the default {?pm-?parameter}.

-LB
 
I probably should have been more descriptive from the beginning, sorry:

Our data is based on a recursive relationship that builds a tree. Only the leaves of the tree have project types associated with them, not the branches. Leaves can have more than one project type.

There are several other things associated with the leaves as well - but I am leaving them out for simplicity purposes. The complexity of this tree is why I am not using groups, and have flattend out the tree structure for the report.

I filter out the leaves of the tree before creating the tree structure itself, which is why the project type parameter must be located in the command object.

Then in the main report, I list the project types. So I need to pass in the current project type of the main report into the parameter that is used in the command object of the subreport.

The result should look something like this:

Project Type A
Tree Value 1
Tree Value 2
Tree Value 3
Tree Value 4
Tree Value 5
Tree Value 6
Tree Value 7
Tree Value 8
Tree Value 9
Tree Value 10
Tree Value 11

Project Type B
Tree Value 1
Tree Value 2
Tree Value 3
Tree Value 4
Tree Value 5
Tree Value 6
Tree Value 7
Tree Value 8
Tree Value 9


I have a parameter to let the user choose which project types they want to show - I cannot simply pass that to the subreport because the tree would display with all values for all of the project types selected, not just one project type at a time.

i agree that the parameters created in the database expert command object 'should be' listed in the subreport link section - but they are not. so how do i link them?

Thanks a ton,
jayme

 
I don't really follow what you are trying to do, but if the subreport parameter is not appearing, it may be that it is of a different datatype than the main report parameter.

It is also unclear why you cannot link to other subreport on the field that you are using the main parameter field to select.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top