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

Shared Variable value becomes ZERO when used in other formulas

Status
Not open for further replies.

Halfcan

Technical User
Dec 8, 2002
214
US
Hello,
I'm using v8.5, I've have a subreport containing a SUM. I I've created a shared number Var forumla to share this number with the main report.
{@ShareIP-Var}
shared numbervar IPS := {@CountElementsSUM}

The answer in this subreport: 943 this is correct.

In the MAIN report I use this:
{@ShareIP}
shared numbervar IPS;

The answer in the main report: 943 this is correct.

Now the problem starts when I attempt to use the result of {@ShareIP} (943) in a other formulas of the main report.

After I place {@ShareIP} into a formula, the value turns to ZERO.
For example:
The calulation I need to use this number (943) is this:
{@Form1}
((({@EndDate} - {@StartDate}) * {@SharedIP) * 1440)

After using {@SharedIP}in {@Form1}
I now get division by zero erros in other formulas that use {@Form1},and {@ShareIP} shows as a 0 on the main report.

Why cant I use this shared numbervar taken from the subreport in calulations on the main report?

Any Ideas?
Thanks,
Andy
 
MORE INFO:
OK, I think the position of my subreport on the main page is a clue.

On the Main report, the area I want to use {@SharedIP} is in a formula displayed in Group 1.

Right now I have the subreport placed in the Page Header of the Main report. If I move it into Group 1, the values in the subreport box go to ZERO.

If I move the subreport to Page Footer, it works BUT ONLY if I make the PageFooter really large. Large enough to the point that the 1st page of the report only show the contents of
the page header and page footer.

If I Resize the page footer down so the Group1 data can be included on the 1st page, it dies - division by ZERO.

Obiviously I don't want to have the 1st page of my report showing just a page header and page footer just to make this work...

Anyone?
Thanks,
Andy

 
All right, This is wacked.

I placed the subreport in the Page Header: PHa

I created second section in Page Header: PHb

I copied the contents shown in Group 1, (Calulatons I'm trying to get to work)
and pasted them into Page Header B.

I suppress PHb.

It calculations now work - not only in PHb, but also in Group 1. What the ?!?!

Andy
 
Let us start all over with this...it is kinda muddled the way you describe it.

I want you to clearly describe the structure of your main report...

IE:

Group 1 header (what field is it based on), suppressed?
Group 2 header (what field is it based on), suppressed?
...
Details
...
Group 2 footer Info
Group 1 footer info

Show me the position of all formulas using the shared variable as well as the position of the subreport. Also where is the value of the Shared variable set to zero?

Also show the formulas ... not just their names that use the shared variable.

**********
I'm using v8.5, I've have a subreport containing a SUM. I I've created a shared number Var forumla to share this number with the main report.
{@ShareIP-Var}
shared numbervar IPS := {@CountElementsSUM}
********

You shouldn't need a special formula for this...it should be part of {@CountElementsSUM}

something like

//@CountElementsSUM

WHilePrintingRecords;
shared numbervar IPS ;
.... (rest of formula)
IPS := (your calculated sum);
IPS;



Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Main report

Group1 is "CustomerName" (there will always only be 1 customer) not suppressed. Well not entirely. the first section of this group (GH1) is suppressed because I was using it as a testing area.
GH2 is not suppressed, that is where I'm placing my formulas.

Group2 Monthname (string)
Group3 MonthDeviceUP (string)
Group4 Customer Affecting (string)
These sections are suppressed entirely, but I don't see how these should have any effect because I'm not doing calculations that use these groups or values created from these groups at all.

Details is hidden not suppressed.

Subreport is in PHa of main report
No groups, shared number is coming from the RHb.

It is working, I just don't understand why creating a PHb section with a copy of the GH2 formulas made it work.

Questions: Is it bad to leave sections in a report suppressed because you want to use them for testing areas for debugging?
Does suppressing in a sense remove that section from processing in the report?
Should I remove all suppressed areas that are not directly responsible for creating the output of the report?

Thanks,
Andy

 
GH2 is the same as Group2 Monthname then

the subreport is independant of your main report I take it...

Why is it in the Page header? is your report only 1 page long?

A suppressed sections/formulas still calculates its values so if these have bearing on future results then this may be your problem.

You haven't really given me much information on the nature/placement of the formulas in question...so I cannot comment on what works or doesn't work....read my tagline and earlier post (i asked for the formulas)

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top