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

Sum a datediff with max dates

Status
Not open for further replies.

cyetka

IS-IT--Management
Nov 4, 2011
2
US
I am trying to sum the results of a datediff formula where the dates are a max of dates based on a condition. I'm trying to determine the average number of days to pay for a customer. I'm using a variable to evaluate and reset the number of days by customer but the evaluation formula is returning "False" instead of a value.

Reading invoice and cash receipt transactions

Grouped by:
Customer
Job
Invoice#

Formulas:
@InvDate - if {transtype} = "Invoice" then AcctngDate
@CRDate - if {transtype} = "Cash receipt" the AcctngDate
@MaxInvDate - maximum(Invdate)
@MaxCRDate - maximum(CRDate)
@daystopay - datediff("d",@MaxInvDate,@MaxCRDate)

@reset - placed in customer group
Whileprintingrecord;
global numbervar SumofDays: =0;

@eval - placed in invoice group
Whileprintingrecords;
global numbervar SumofDays;
SumofDays = SumofDays + @DaystoPay;

@display - placed in customer footer
Whileprintingrecords;
global numbervar SumofDays;




 
You have missed the colon when assigning value to SumOfDays

@eval - placed in invoice group

Whileprintingrecords;
global numbervar SumofDays;

SumofDays:= SumofDays + @DaystoPay;

Ian
 
I knew it was staring me in the face!

Thank you Ian.

Christine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top