Options

Problem with CALCDATE in a report

DarkHorseDarkHorse Member Posts: 389
Hello, I want to do in a report an easy calc. I've "Posting Date" field from "Purch. Rcpt. Header" and "Confirmation Date" field from "Purch. Rcpt. Line" table. I want to calc the days between a date and the other. I put:

IF ("Purch. Rcpt. Header"."Posting Date"<>0D)
AND ("Confirmation Date"<>0D)THEN
BEGIN
calc2:=CALCDATE("Confirmation Date","Purch. Rcpt. Header"."Posting Date");
END;

calc2 is a Date variable.

It runs well but, in several cases, it appers an error on run the report that says:
"The Content .... from CALCDATE parameter number 1 is invalid"
In dots appears a date, depends of the filter. I suppose that intent to do the operation but there are assumtions that can't calculate. I've try to put several conditions like "if this case is <>0D show 0" and thinks like that, but always appers the same error. Does anybody knows what can be the problem?.
Thanks in advance.

Comments

  • Options
    reijermolenaarreijermolenaar Member Posts: 256
    To get the number of days between two dates you can subtract them:
    Result := "Confirmation Date" - "Purch. Rcpt. Header"."Posting Date";
    

    Regards,
    Reijer
    Reijer Molenaar
    Object Manager
  • Options
    DarkHorseDarkHorse Member Posts: 389
    :oops: I've trying with CALCDATE; well thanks for your help. Another question, sometimes the result is negative; is there any way that shows always in postive?.
    Thanks for your help.
  • Options
    reijermolenaarreijermolenaar Member Posts: 256
    Yes, that is possible with ABS.
    ABS("Confirmation Date" - "Purch. Rcpt. Header"."Posting Date");
    
    Reijer Molenaar
    Object Manager
  • Options
    DarkHorseDarkHorse Member Posts: 389
    Fantastic!!! =D> , Thank you very much for your help and time.
Sign In or Register to comment.