Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: shared var & subreports & duplication Post Reply Post New Topic
Author Message
spl1
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 20
Quote spl1 Replybullet Topic: shared var & subreports & duplication
     Posted: 19 Jun 2009 at 4:00am
Hi
I have got a main report with GH/GF 1-5 for grouping purposes.
I have placed the subreport and suppressed it in GH3, placed the shared variable inc whilstprintingrecords in GH4
The first line details the correct info of ie £10, line 2 shows £10 but should £0... lines show £10 until then next change ie line 6 states £11, then the next line will state £11 until the next change - hence duplication / not resetting subreport at each line change
 
Can you guide me as to how to reset the data at each line OR if i've done my formulaes incorrectly
 
Many thanks
Sarah
Sarah
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jun 2009 at 6:51am

It sounds the shared variable is not being reset...can't be sure, but it would seem that the there is addition being done to the shared variable.

You 'set' the variable in gh3 and display it in gh4.  In the subreport, I would probably set the variable :=0 in the report header, this way, it always starts at 0 for each subreport.
 
HTH
IP IP Logged
spl1
Newbie
Newbie
Avatar

Joined: 18 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 20
Quote spl1 Replybullet Posted: 19 Jun 2009 at 11:04am
Thank you very much, it worked and reset the shared variable.
However.... now need to subtotal it by group and again crystal keeps telling me I cant summarise the field...
I'm new to shared variables but starting to understand how to bring the data across into the main report but still unclear on how to subtotal as the field does not show if i try the basic way to "insert summary"
 
Thank you again in advance
Sarah
Sarah
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 19 Jun 2009 at 11:22am

Since the results of the formula is from a conditional formula, you need to use the shared variable to summarize.  Say that currently you are using the shared variable and it is displaying correctly in gf3 and you want a summary of the values in gf2...pretty common.  What you would need to do is have another shared variable that you are incrementing that will displayed in gf2, and so on down the line for gf1 and rf.  Each would need a formula that will reset its value, increment its value and display its value.

 
For incrementing, you can update all the variables when the details are set, or you can increment them in the GFs. 
 
I hope that this makes sense, and as you can see, it can lead to a lot of formula to keep track of, but it will work.  You might be able to get away with a running total.  Frankly, I don't understand them...I plan to look at them for the next report, but it seems that they are doing pretty much the same thing.
 
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum