Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Resolved Shared Variable not passed to subreports Post Reply Post New Topic
Author Message
KenN
Newbie
Newbie
Avatar

Joined: 02 Oct 2010
Location: United States
Online Status: Offline
Posts: 3
Quote KenN Replybullet Topic: Resolved Shared Variable not passed to subreports
    Posted: 02 Oct 2010 at 8:52am
I have a report that I want to summarize different business information during any period I enter as a parameter.  I have a main report summarizing bank deposits, a sub-report summarizing  sales taxes collected for different jurisdictions, another summarizing gross profits.  This info is all in three tables with database links.

I have a start date and end date parameter set on the main report.  I need to pass these parameters to the sub-reports so that all of the information is from the same date period.  Here's what I've tried:

Parameters:
  • StartDate (as a date field)
  • EndDate (also as a date field)

Formulas
  • On the main report
    • Named "Assign End Date"
      • Shared DateVar ShrEndDate;

        ShrEndDate:={?EndDate};
    • Named "Assign Start Date"
      • shared dateVar ShrStartDate;

        ShrStartDate :={?StartDate};

  • On each Sub-Report
    • Named "Place End Date"
      • Shared DateVar ShrEndDate;

        ShrEndDate
    • You probably get the idea on Start Date.
When I place the field "Place End Date" into the sub-report anywhere, It shows empty.  I've tried placing it in the details section, any of the group and report headers.  Empty.

I try using the "Assign" formula on the main report; it has the data.  What am I doing wrong? 

None of the sub-reports are suppressed.



Edited by KenN - 05 Oct 2010 at 8:50am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 04 Oct 2010 at 6:52am
have you tried linking the subreport to the main report, that is way that CR is set up to work...you link the values in the main report to the parameters in the subreport.
 
HTH
IP IP Logged
KenN
Newbie
Newbie
Avatar

Joined: 02 Oct 2010
Location: United States
Online Status: Offline
Posts: 3
Quote KenN Replybullet Posted: 05 Oct 2010 at 6:28am
Well, I just tried linking my parameters to the sub-reports.  It worked on one of them.  This seems like the easiest way to accomplish this task. 

When I edit the links in other sub-reports, the parameter seems to show, then when I go to edit the sub-report, the parameters are not there.  I go back to the main form, look at the links for the other sub-reports and it shows no links.

I like this process better than formulas, so what could I be doing wrong?
IP IP Logged
KenN
Newbie
Newbie
Avatar

Joined: 02 Oct 2010
Location: United States
Online Status: Offline
Posts: 3
Quote KenN Replybullet Posted: 05 Oct 2010 at 8:48am
I figured it OUT!!!

This is NOT straight forward.  In order to link to a parameter, I found that I had to have a formula in the sub-report that points at the parameter.

The sub-report that has the "Place" formula from the first post took the link.  So I added these same formulas to the other sub-reports.  Viola!  Those sub-reports let me link them to the parameter.

I don't know why (or if, actually) that this has to be done, but it works.
Newbie without a clue
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.018 seconds.