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

Oracle dates in formulas

Status
Not open for further replies.

312fast

Programmer
Aug 23, 2001
2
US
I am attempting to write a formula that checks if the date in the Oracle 8 record being processed is equal to either the minimum or maximum date in the table. The formula does not contain errors but I cannot create a summary field for the formula. Why won't it let me add a summary total?

//Works:
If ({IND_C} = 6.00 and {ACCTG_DATE_D} = Date(2001,1,1))
or ({IND_C} = 12.00 and {ACCTG_DATE_D} = Date(2001,7,1)) Then
{PREV_CNT}
else
0

//Does not Work:
If ({IND_C} = 6.00 and {ACCTG_DATE_D} = (Year(@AcctgMin}), Month({@AcctgMin}), Day({@AcctgMin}))
or ({IND_C} = 12.00 and {ACCTG_DATE_D} = (Year({@AcctgMax}), Month({@AcctgMax}), Day({@AcctgMax}))) Then
{PREV_CNT}
else
0

@AcctgMin and @AcctgMax are formulas:
@AcctgMin:
dateVar minAcctgMo:= Minimum ({ACCTG_DATE_D});
Date(Year(minAcctgMo), Month(minAcctgMo), Day(minAcctgMo))

@AcctgMax:
dateVar maxAcctgMo:= Maximum ({ACCTG_DATE_D});
Date(Year(maxAcctgMo), Month(maxAcctgMo), Day(maxAcctgMo))
 
Try adding "WhilePrintingRecords;" to the top of the formula that is using the @AcctgMin and @AcctgMax formulas

By this means you control when the comparison formula does its job...without "WhilePrintingRecords;" in the formula it may be trying to do this comparison as it is reading the records.....at that time it doesn't have the values for the Min/Max dates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top