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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Data to Subreport

Status
Not open for further replies.

tschallb

IS-IT--Management
Nov 16, 2004
20
US
Hi Folks,
I have a Invoicing Report that includes a Subreport that I created and I use a Subreport Link to pass a value to the subreport to display more detailed information. Everything works great as long as there is only one value to pass to the subreport. In rare circumstances there will be two values but unfortunately, only the first value is passed and then the report moves to the next invoice. What can I do to get the Subreport to recognize there is another value?

BTW: Crystal Reports 8.0
Thanks,
Tim
 
Don't use a link to pass a value, use a shared variable.

Since you don't describe how these values are created to be passed, nor where the subreport is in the main report, it's difficult to address this accurately.

Shared variables are created by using something like:

whileprintingrecords;
shared Numbervar Num1:= {table.value1};
shared Numbervar Num2:= {table.value2};

These would be created in a section PRIOR to the subreport, and then the subreport can reference them.

-k
 
Thanks K,

Sorry for my vague question. I am just getting up to speed in Crystal. The values being passed are returned as part of my original SQL query. They are simply PO numbers. 90% of the time there is one PO # but sometimes an invoice needs to reference two PO numbers. The subreport then queries the PO table to show how much money is left in the PO. In my special case I need them both to show.

I will take a look at your suggestion.

Thanks,
Tim
 
One way to do this is to insert a Group by the PO Number in the main report, and then Insert your subreport in the Group header or footer, and link by the PO Number.

Then the subreport will fire for each PO.

-k
 
I should add to this that I dislike subreports due to performance, since you're only doing 1 or 2 rows, it shouldn't matter much.

Another approach might be to pull all of the data from within the main report, or use a subquery in a Crystal SQL Expression (very advanced topic), or create a View on the database (my preferred method).

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top