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

Shared Variable Problem

Status
Not open for further replies.

tammic

MIS
Apr 7, 2003
17
0
0
US
In my report I have created a subreport and a shared variable within the subreport to pass data to the main report. I have done this in the past, but for some reason the value shows up one line down from where it should be. I cannot find anything wrong in my subreport or shared variable that would cause this.

Any ideas?
 
Well move it up one line...

I'll guess that you mean that it's returning a value one row beyond what you're expecting?

Where the subreport is within the main report is crucial, keep in mind that the subreport must fire before the shared variable is used in the main report, typically people will right click a section and select insert section below, place the sub in the upper, and use the variable in the next section.

If this doesn't help, post technical information.

Where is the subreport?
What is the formula?
Where is it used in the main report?

-k
 
Thank you for your reply. Unfortunately that is not the problem because my subreport is already one section up. I am not sure if the problem might be that there are multiple detail sections on this report. Some of them are "suppressed" based on the record type, but the section with the subreport is not. I have even made the subreport values visible and they show correctly above the line where they are intended, but actually print two lines below that.

I have the subreport located one section above, I have placed the shared variable on the section below, and the subreport is placed at the beginning of the line, just in case.
 
Have you checked the format of the subreport section and verified that Underlay following section is uncheck?
 
Well if you're compelled to answer my questions, I'll gladly share my thoughts.

Not sure what "subreport is placed at the beginning of the line, just in case"

What line? You mean the beginning of the section?

Simplify things for test by inserting another section directly below the subreport and just display the shared variable.

-k
 
Wow -- this is the most stubborn Crystal problem I have ever had!! Here is my setup:

I have a subreport called EffSub.rpt that is located one section above the main section. Here is the shared field as defined in the subreport:

WhilePrintingRecords;
Shared NumberVar zzz := {vEfficiency.Efficiency}

Then in the main report, I have a field defined as follows:

WhilePrintingRecords;
Shared NumberVar zzz

I have displayed in the section above the main section the returned values of the subreport. It looks fine. But on the next line which is the main report, the returned value is displaced by one line. I even tried inserting another section in between the subreport and the main report and putting the shared value there -- it is still wrong.

Thanks for your help -- let me know if you have any other hunches!
 
You still have not answered the question about WHAT section. Is your subreport in a group header, detail, group footer, report header, or report footer section? In which of these sections is the shared variable? Is it in a group header_b section, a detail_b section, etc.?

-LB
 
Sorry 'bout that --

My subreport exists in the detail section -- section Dd. The shared variable is in section De. There are other detail sections above this that aren't related, but I have a hunch the fact that I have multiple detail sections might be the root of my problem?

 
So the values you are getting for the shared variable correspond to the subreport in the previous detail_d, not to the subreport in the current detail_d section?

I can't recreate your problem, so am not sure this will help, but you might try creating a reset formula for the shared variable, as in:

//{@reset};
whileprintingrecords;
shared numbervar zzz := 0;

Place {@reset} in the detail_a section.

-LB
 
I found the problem but not the answer. The shared variable from the subreport actually prints two lines down from where it is suppose to be. Because I have multiple detail sections, Da, Db, Dc, Dd, De -- Db actually prints within the Dd section but is suppressed on a certain condition. When I took at this section -- the report is fine. But the problem is that I need this section. If this is hard to follow, here is a synopsis.

Order of print:

Da
Dc
Then multiple, recurring sections:
Dd
De
Dd
De
Dd
Db
De
Dd

That Db towards the end was giving me the problem. Can you follow that? How do I have the formula ignore that section?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top