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

shared variable from subreport

Status
Not open for further replies.

n2nuk

IS-IT--Management
Dec 24, 2002
190
GB
I have created a shared variable that is returning a date from a subreport to my main report. I have placed the sharedvar field in group b. My subreport is in group a. This is working fine.

The reason for returning the date from the subreport is so I can use it calculate the number of days difference between a date on my main report. When the shared variable returns a date the report correctly tells me the number of days between the 2 dates, however when the shared var returns null or nothing the report uses a date from the previous group. Is there any way I can stop this from happening?

Here are the formula's I am using

on the subreport
whileprintingrecords;
shared datevar firstassessmentdate := minimum({assessment.assessment_date})

Main report formula
whileprintingrecords;
shared datevar firstassetdate;
this is placed in group B

datediff formula on main report
datediff ("d",{client.Start_Date},{firstassessmentdate}) this is also placed in group B

Many thanks
 
I kinda remember having this issue before. The way I got around it is setting the shared variable to a 'Null' value. I am not sure if you can set a date to a Null value, but if you where to set to like '1/1/1900' and then check for that value in your formula prior to the date diff (not sure what you want to do), then that should work.
 
Ive done something very similar but its not working[ponder]

On my subreport I created a new formula,
@firstassdate
if isnull ({assessment.assessment_ref}) then DateValue (1900,01,01) else {assessment.assessment_date}

and then pointed the shared variable at the sharedvar formula:
whileprintingrecords;
shared datevar firstassessmentdate := minimum({@firstassdate})

on the main report its not picking up the null value and still presenting the date from the previous group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top