Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Shared Variable showing data for previous GFooter Post Reply Post New Topic
Author Message
kendo469
Newbie
Newbie


Joined: 21 Dec 2010
Online Status: Offline
Posts: 4
Quote kendo469 Replybullet Topic: Shared Variable showing data for previous GFooter
     Posted: 21 Dec 2010 at 2:41am
Hi,
 
I have created a shared numbervar to pull data from a subreport and total it in the main report.
 
My main report has agent performance data with totals in a group footer by agent. My subreport has agent activity data with totals in a group footer by agent.
 
My Sub report SharedV shows the correct data for each agent, but my Main report SubR SharedV only shows data 'l' for the last agent in each group and for the previous record.
 
example
(MAIN REPORT)
GF2 Agent1    a      b     c  (Shared Var total for b + c + j for Agent1)
GF2 Agent2    d      e     f   (Shared Var total for e + f + k for Agent2) 
GF2 Agent3    g      h     i   (Shared Var total for h + i + l for Agent3)  
 
(SUB REPORT))
GF2 Agent1    j      
GF2 Agent2    k     
GF2 Agent3    l      
 
Any advice would be greatly appreciated.
 
Ken.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 21 Dec 2010 at 4:54am
when does the subreport run?  it is like in the example above...After the main report?  If so, that would be the reason.
 
Basically, you need to run the subreport before displaying/using any shared variables.
 
If you just need the results of the subreport, but not the report itself, here's what you can do (as DBlank reminded):
 
1) place the subreport in it's own section
2) suppress the display of all fields in the subreport
3) in the section that the subreport is in, go to section expert and check Suppress Blank Section
 
and remember to place the section above the section you want to utilize the values in.
 
HTH
IP IP Logged
kendo469
Newbie
Newbie


Joined: 21 Dec 2010
Online Status: Offline
Posts: 4
Quote kendo469 Replybullet Posted: 21 Dec 2010 at 10:37am
Thanks for your reply. Basically I have been asked to produce a report with the top level agent data across the top and a subreport to drill down on the individual agent data.
 
Then I need to add each agent's individual total from the subreport group footer the their totals in the main report to give an average handling time.
 
The subreport runs after the main, but I need to show the subreport for them to see the breakdown.
 
Thanks, Ken.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 22 Dec 2010 at 3:22am
the design as described won't work, the subreport needs to be run for the agent while the agent is in 'scope' so to speak.  Another way of saying this is that if there is a grouping by agent, the subreport needs to be run inside of the agent's group.
 
Crystal processes from top to bottom, so when you are at the end of the report, it will only process for the last agent.  In addition, even it processed for every agent, you cannot calculate the average for an agent and display it with the agent's data in the main report, as it has been printed and Crystal has moved on...it won't go back and change anything...which is why the subreport has to be called during the time that the agent's data is being printed on the report, not at the end.
 
HTH
IP IP Logged
kendo469
Newbie
Newbie


Joined: 21 Dec 2010
Online Status: Offline
Posts: 4
Quote kendo469 Replybullet Posted: 22 Dec 2010 at 11:42am
Thanks for the reply. So in your experience, is there any way that what i want to show on the report can be achieved or is there another solution?
 
Thanks, Ken
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Dec 2010 at 3:31am
sure, it's just a matter of timing, so to speak
 
main
  gh agent
     subreport
  gf agent a b c (b+c+j)
 
If you are just looking at the summary, you can suppress gh agent and
'hide' the subreport. 
 
Having just done this (I don't use supreports too often, much less hidden) the step to 'hide' a subreport
1) place it in it's own section
2) in the section expert 'Suppress Blank Sections'
3) suppress all fields in the subreport
4) ...and this is the one I forgot, right click the subreport / format the subreport / subreport tab...'Suppress Blank Subreport'
 
now you can access the shared variable that the subreport is returning and use it to compute the values for each agent.
 
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