Problem with IF and option field compiling.

This won’t compile. Keep getting an error message on the Yes. JobComplete is an Option field with No, Yes the only 2 values on it.

IF (JobComplete = JobComplete::Yes) AND

(JobCompleteDate = 0D) THEN BEGIN

JobCompleteDate:=WORKDATE;

END;

This works but I hate to hard code the 1 in there:

IF (JobComplete=1) AND

(JobCompleteDate = 0D) THEN BEGIN

JobCompleteDate:=WORKDATE;

END;

Thanks in advance,

Greg

Attached is the error message:

END;2728.untitled.bmp (576 KB)

Your option value is " Yes", with a space before the Yes part. Don’t put spaces between option values. Unless of course that is your intention, and you need to code it like this:

IF (JobComplete = JobComplete::" Yes") AND

The parentheses are not necessary in this case, although I like them there.

So, instead of the optionstring “No, Yes”, change it to “No,Yes” without a space after the comma, and your original code should compile just fine.

Thanks Daniel.

Greg

no problem, it’s an easy mistake to make (I have regularly made it myself) [:)]