Skip to Content
0

Get Current amount based on the date range

Feb 08 at 11:27 PM

35

avatar image
Former Member

I am getting an error if the ProcessDate is empty, but if there's date it's working fine. how can I resolve this?

I again used the below formular in a summary field to get all amount per group based on a range.

This is my formula :

IF {FinTran.ProcessDate}>={?StartDate} AND {FinTran.ProcessDate} <= {?EndDate} Then
    {FinTran.AmountReportingCCY}
ELSE
    0
error.png (5.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Feb 12 at 01:06 PM
0

Using Crystal Syntax managed to come through. CurrentAmount Formula =

Local NumberVar amount:= 0; 

If CDate({FinTran.ProcessDate}) IN {?StartDate} to {?EndDate} THEN
    amount := ToNumber({FinTran.AmountReportingCCY})
else
    amount
Share
10 |10000 characters needed characters left characters exceeded
Abhilash Kumar
Feb 09 at 04:24 AM
0

Hi,

What part of the code is highlighted when the string error shows up?

Do the datatypes of the StartDate, EndDate and {FinTran.ProcessDate} match?

-Abhilash

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

{?StartDate} : Date

{?EndDate} : Date

{FinTran.ProcessDate} : DateTime

Part of the code which get's highlighted :

IF {FinTran.ProcessDate}>={?StartDate} AND {FinTran.ProcessDate} <= {?EndDate} Then
0

And what about the "{FinTran.AmountReportingCCY}" field?

Is that number or a string?

-Abhilash

0
Former Member
Abhilash Kumar
{FinTran.AmountReportingCCY} : DataType = Decimal
0
Vitaly Izmaylov
Feb 08 at 11:39 PM
0

Try to add the following logic in the beginning of your formula:

If not ( IsNull ({FinTran.ProcessDate})) then ...

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I tried that suggestion but still showing similar error after the first if statement.

Not sure what's causing the issue.

IF NOT (ISNULL({FinTran.ProcessDate})) Then
    If {FinTran.ProcessDate} >={?StartDate} AND {FinTran.ProcessDate} <= {?EndDate} Then
       formula = {FinTran.AmountReportingCCY}
    else
        formula = 0
    end if
ELSE
    formula = 0
end if

0