Skip to Content
avatar image
Former Member

Get Current amount based on the date range

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

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

    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
    
    Add comment
    10|10000 characters needed characters exceeded

  • Feb 09 at 04:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 08 at 11:39 PM

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

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

    Add comment
    10|10000 characters needed 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