Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Create Shared Variable for Summary? Post Reply Post New Topic
Author Message
BatteryMan
Newbie
Newbie
Avatar

Joined: 28 Jun 2012
Online Status: Offline
Posts: 4
Quote BatteryMan Replybullet Topic: Create Shared Variable for Summary?
     Posted: 19 Jul 2012 at 5:16pm
Hello all,
 
I'm creating a report detailing picking productivity, specifically, picks per hour. I have the main report, which contains the picker's name (in Details) and all the hours spent picking different order types (5 different types, in Report Footer) and they are driving a pie graph detailing the pickers' time spent in each area.
 
I have a subreport which calculates the number of picks and number of cases picked. Now I need to pass a sum of the 5 different pick types to the subreport from the mainreport so that I can calculate picks per hour (cases/picks=pph).
 
I've been searching EVERYWHERE and have tried several different ways found online to setup the shared variable but it's not working. Any help?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 20 Jul 2012 at 5:32am
A couple of things you need to remember about shared variables and sub-reports.  The name for the shared variable needs to be defined in every formula that it is used in the main report and subreport.  To get values back to the main report, the sub-report must be in a previous section to where you are looking at the shared variable in the main report (I hope that made sense).  The subreport cannot be suppressed or in a suppressed section (there are ways around this if you do not want to see the subreport).

I hope this helps.
IP IP Logged
BatteryMan
Newbie
Newbie
Avatar

Joined: 28 Jun 2012
Online Status: Offline
Posts: 4
Quote BatteryMan Replybullet Posted: 20 Jul 2012 at 11:22am
Thanks for your reply! Unfortunately, those are the parts of the puzzle that I understand. I need specific syntax if possible.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 23 Jul 2012 at 5:30am
Syntax is easy;
Shared numbervar (or currencyvar or stringvar, etc.) variable_name;

Now to get a value from the subreport, make sure that it is in a section prior to where you need the values in the main report.

Also make sure that the shared variable is defined in each function that you need it in the subreport and main report (if you want just display the value in the main report, then you just need the shared variable defined in the main report).   I think there are some tutorials on the web that show all this.

I hope this helps.
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