Skip to Content
0
Former Member
Nov 19, 2008 at 07:46 PM

Passing variables between subreports.

361 Views

I am using Crystal XI to develop a single report with several tables that are not linked. I do not have authority to link the tables and due to red tape, cannot get them linked. I currently have two separate reports with subreports inside of them and when inserting one of the reports as a subreport inside the other report, none of the subreports remain.

The current reports have a master table which the majority of the data is retrieved. Then there is an association table that has several records for each of the master table records. I am extracting a count of a specific type of association with each master record in a subreport. Both reports are doing the same thing except using different tables, but the table relationships in each report are the same.

I thought I might be able to overcome this by using shared variables between subreports. I have the book "The Complete Reference Crystal Reports XI" that states this can be done. However, I have not been able to get this to work.

I have even tried to pass a shared variable from subreport 1 to the main report and then to subreport 2 and vice versa with no success.

What I have done thus far is I created a shared variable in subreport 1 with the record key I want a count for and then created the shared variable in the main report. Then I create the same shared variable in subreport 2 and linked it to the shared variable in the main report. Then I created a shared variable in subreport 2 with the count of associations for the record key and created the shared variable in the main report. Then I create the shared variable in subreport 1 for the count, but when the report display I get all zeros.

I have tried several other ways to pass the variables back and forth with no success.

Does anyone have a better idea of how to combine the two reports or how I can share these variables between subreports?