Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REPLACE WITH NULL (??)
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00254209
Message ID:
00254238
Views:
19
>I would like to replace a DateTime value with a NULL value in a particular view, when the user chooses a certain option. I'm getting an error "Not a character expression".
>
>Can I REPLACE the value of a datetime field in a cursor with a NULL?
>
>*=============================
>REPLACE CompleteDate WITH NULL
>*=============================
>
>I need to be able to display other options based on whether or not a Completed Date and Time have been entered. On top of that, I need to be able to "un-complete" the entry if need be (ie, null out an entered CompletedDate for a given record).
>
>I have not yet added a boolean field for Completed because I thought I could just use the value of the date fields. Should I rely on a boolean field instead?
>
>Any suggestions? Thanks!

It looks like you're missing the dots around NULL in your code. So, your code should read:

replace CompleteDate with .NULL.

This will only work, of course, if you've defined the field as accepting null values.

One caution about using nulls, you'll find that the typical tests for the values in fields will not be accurate, and you'll constantly have to be using ISNULL() to test for null values. So, in the case of your date field, you'd have to say ISNULL('CompletedDate') or empty('CompletedDate'). You might find a flag easier to deal with.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform