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 if Null taking the data from line above 1

Status
Not open for further replies.
Dec 16, 2008
83
GB
Crystal 2008

Hi,

I've got a subreport which i'm sharing datetimevar to the main report. My problem is, if there is no data in the subreport which matches the account ID in the main report the subreport is obviously blank, however my shared variable is pulling through values from the line above that does have data. So all null sharedvar values that have no data in the subreport is having a date populated in it which isn't correct. Is there some way of stopping this happening?

my formula in the subreport is:

whilePrintingRecords;
Shared datetimevar mincalldate := Minimum ({tblNotes.EntryDate}, {tblAccount.AccountID})

and my formula in the main report is:

WhilePrintingRecords;
Shared datetimeVar mincalldate;
mincalldate

Many thanks in advance
 
i've tried a reset in the Group header 4a of:

WhilePrintingRecords;
DateTimeVar mincalldate := DateTimeValue (1899, 01, 01, 00, 00, 00);

however it still pulls through data from the line above instead of the current record if the current record doesn't have a value from the subreport.

my subreport is currently in Group header 4a and my shared variable is in the section below 4b. (in the example above for the reset i shuffled everything around)
 
Your reset formula should be in GH4a, your sub in GH4b and your formula referencing the shared variable, in GH4c.

-LB
 
lbass, i tried exactly as you suggest and still no luck. do you have any other ideas or suggestions?
 
I just realized the problem--you have to declare the variable as "shared" in both main and subreports. Also, for your reset, I would use: date(0,0,0,0,0,0).

-LB
 
but surely lbass if you see in the formula's above i have declared both variables as shared?
 
Not in this one:

WhilePrintingRecords;
DateTimeVar mincalldate := DateTimeValue (1899, 01, 01, 00, 00, 00);

...which should be:

WhilePrintingRecords;
shared DateTimeVar mincalldate := datetime(0,0,0,0,0,0);

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top