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!

Passing null subreports through shared variable in Crystal Reports 1

Status
Not open for further replies.

lisa13ep

Technical User
Apr 18, 2012
12
US
I am using shared variable to transfer data from subreport, I have some null subreports and in that case the variable shows up with the value from previous line instead of 0. How can I fix this? IsNull function soesn't seem to work on variable. Thank you for your help
 
You need to add a reset formula in the main report. If the sub is in GH1b, add a reset formula in GH1a, like this:

whileprintingrecords;
shared numbervar x;
if not inrepeatedgroupheader then
x := 0;

-LB
 
Thank you for responding.
I've put it in, but now it turns eveyrthing to 0.
Also I have subreports showing per item, but trying to tansfer group summary and it transfers only the last item, not the totals.
 
Please explain in what main report section your subreport is located and also the section in which you placed the reset formula.

You also refer to showing a sub per item, but I don't know what field you are grouping on. So identify the groups by the field grouped on and then please clarify at what level you are trying to show a summary.

-LB
 
I mam grouping by item type. The subreport goes into details section, and I created the second details section below for variable. In the subreport I have totals calcuated per item type, when I try to transfer those totals through shared var it comes up with 0. It only transfers numbers if I put shared var in the details, but again it replaces null subreports with previous record instead of 0. Hope this helps, thank you
 
Insert another detail section and toggle it so it becomes detail_a in the section expert. Then the sub goes in detail_b, and the shared variable in detail_c. You can suppress detail_a. You cannot hide or suppress detail_b. If you need the sub not to show, let me know.

-LB
 
Thank you so much! It did work. Is there a way to summurize that data? I was trying to put var in the group and declare it as a summary, but it comes up with 0. And I can't put subreport into group due to not being able to link properly. The formula editor says that my var is can't be summarized. Please help
 
What is your goal? If you just want a summary at the group level, then you should be putting the sub in a group section, so then you should explain the problems you were running into when linking. Explain also how you are linking when placing the sub in the detail section.

-LB
 
Here is what I am doing. I have main report and subreport that are structured the same way - details and one group level by product line with summary.
I have inserted subreport into the group and it is linked through product line. All the details in both main report and subreport are supressed (we don't need to see them) and all the data is transferring correctly.
I've created a shared var in subreport:

WhilePrintingRecords;
Shared CurrencyVar SalesTotal := sum ({@amount});

And put it in the group footer (I've tried report footer - it works the same way) of subreport - if I don't put it anywhere in subreport it comes up with 0.

Then in the main report I've created this var:

WhilePrintingRecords;
Shared CurrencyVar SalesTotal;

I need to put it in the main report footer to get the grand total of subreports. But it only shows the last subreport's value instead of summarizing.

Please advise what needs to be fixed. Thank you
 
Thanks again, please disregard my previous post, I found your previous answer to the similar question and it worked!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top