Skip to Content
0
Former Member
Nov 01, 2012 at 08:30 PM

Running Total not working with shared variable

167 Views

I have a report with a subreport that returns a shared variable with a date. The date may or may not be there for each detail record.

WhilePrintingRecords;

Shared DateVar stopdate := CDATE (0,0,0) ;

stopdate := {table.StopDate}

The main report grabs the shared variable into a formula called stopdate and prints (or not) on the detail line. Works fine.

whileprintingrecords;

shared datevar stopdate;

stopdate

I want to set up a total for the group and the report total for several main report number fields to only add to the sum calculation IF the date exists AND is within a Parameter range entered by the user.

So far I am unsuccessful at creating a running total with the following expression in the evaluate button of the group and report running total fields I created:

whileprintingrecords;

shared datevar stopdate;

// Don’t evaluate(sum) if blank or out of range.

IF (stopdate = cdate(0,0,0)) then

false

else

IF (stopdate IN {?fromvaladd} to {?tovaladd}) then

true

ELSE

False

It works except it totals the NEXT record qty instead of the current record qty into the sum.

Not sure what I am doing wrong or not understanding.

Thanks

Message was edited by: Rick F