Incorrect data type for operator or @Function - HELP!

Not an designer expert by any means, but I’m still embarrassed to say I’m struggling with what I think should be an very easy calculation, calculating days open in a form. I’ve scoured the forumns and the designer help, but still can’t figure it out. Any help would be greatly appreciated!

I have a form with 3 date fields:

  • Date1: date the form is created (@created, date/time type, computed when composed)

  • DateOpened: date the form is opened by svc dept (@modified, date/time, computed)

  • DateClose: date the form is closed by svc dept (@today, date/time, computed)

  • Status: editable dialog list (“”, OPEN, or CLOSED). Upon closing the ticket, I’m using @SetField(“Status”; “CLOSED”

  • DaysOpen: # of days open, (Number type, computer) when ticket is closed this no longer changes. when not closed, this should continue to calculate the days open.

My DaysOpen formula:

t1 := DateOpened;

t2 := @Today;

t3 := DateClosed;

@If(Status!=“CLOSED”); (t2 - t1)/86400; (t3 - t1)/86400

I continue to get the following error:

Field: DaysOpen: “Incorrect data type for operator or @Function”: Time/Date expected

Thank you!

EKillian

Subject: Incorrect data type for operator or @Function - HELP!

Dear Ed

There is definitely a typo, but not sure if in your live code or just your post.

Your post says FIELD DateClose, but your formula refers to DateClosed.

Basically, any fields that are blank/null are considered to be text/string - one of Note’s more endearing features. Also I wouldn’t use @modified for your date Opened - the way you have this and your dateclosed, both these fields will compute each time the document is saved for any reason.

Another option is to make both these fields CWC and blank initially, and then use actions to set the values during the workflow. For example your ‘Close’ button could be:

@command([EditDocument];“1”);

FIELD DateClosed:=@now;

FIELD WhoClose:=@username;

FIELD Status:=“CLOSED”

You could do a similar button to ‘Open’ the call.