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

Shared variable not showing

Status
Not open for further replies.

xtreemnet

Programmer
Joined
Aug 9, 2003
Messages
88
Location
NZ
Hi

I am showing 2 shared variables from a subreport into the main report and using them for calculation.

Now I have added a 3rd shared variable to the main report from the subreport. It shows the value in the sub report part of main report. But if I try to show it in the section below it shows a value of the previous record.

eg.

---In the Sub Rep inserted-- ---Main report---
record shared1 shared2 shared3 shared3 displayed
no in section
below
1 4 1 11 0
2 2 3 5 11 (previous)
3 7 5 4 5 (previous)

Cannot figure out why this is happening,

Please help

Thanks

 
Where are these subreports in the main report?

If you reset the shared variable PRIOR to going into the subreport (in a section before the subreport fires), then this should never occur.

Ex:

GH1 formula:
whileprintingrecords;
shared numbervar MyNum:= 0 //resets the number

Details section subreport formula:
GH1 formula:
whileprintingrecords;
shared numbervar MyNum:= sum({Subtable.field})

GF1 formula:
whileprintingrecords;
shared numbervar MyNum

It sounds like you're displaying the value prior to the subreport firing.

-k
 
There is only one subreport and it has 3 shared variables. I have no trouble with 1st and 2nd variables. Its only the 3rd variable which is not working properly.

The details of this variable are as:

In the Sub Report:

@RT_formula:

WhilePrintingRecords;
numberVar f1063c1_394_281_sub;

if PreviousIsNull ({Unitreg.UNIT_ID}) and ({Preunit.LEVELL}>=2)
and ({domainn.SUB_FIELD_ID}=394 or {domainn.SUB_FIELD_ID}=281) then
f1063c1_394_281_sub :=f1063c1_394_281_sub + {Preunit.CREDIT}
else

if ({Unitreg.UNIT_ID} = Previous ({Unitreg.UNIT_ID})) and ({Unitreg.LEARNER_ID} = Previous ({Unitreg.LEARNER_ID})) then
f1063c1_394_281_sub :=f1063c1_394_281_sub else
if ({Preunit.LEVELL}>=2) and ({domainn.SUB_FIELD_ID}=394 or {domainn.SUB_FIELD_ID}=281) then
f1063c1_394_281_sub :=f1063c1_394_281_sub + {Preunit.CREDIT};

f1063c1_394_281_sub


This is placed in the detail section and displayed in the report footer as:

@Display_RT:

WhilePrintingRecords;
numberVar f1063c1_394_281_sub;
f1063c1_394_281_sub

The shared variable formula is as below placed in the report footer too:

@SharedVariable:
WhilePrintingRecords;
shared numberVar SubRepGrpC_394_281 := {@Display_GrpC_394_281};
SubRepGrpC_394_281;

Hope this is clear,

Thanks,
 
Hi
This in continuation of the previous reply:

In the report header the variables are reset:

@reset:

WhilePrintingRecords;

numberVar f1063c1_394_281_sub := 0;
shared numberVar SubRepGrpC_394_281 := 0;


Main Report:

The subreport is linked on a field called Learner.

I am showing main report as a footer section. So the subreport is placed
in the footer section above the one I am using to display report.

Th variable used to display the shared variable is:

@shared_in_main:

WhilePrintingRecords;
Shared NumberVar SubRepGrpC_394_281;
SubRepGrpC_394_281;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top