Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replacing only blank fields
Message
From
16/01/2003 19:48:44
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00742691
Message ID:
00742697
Views:
17
>Good day everyone!
>I am trying to code a button that when pressed will look through a field and if it finds any empty fields in the table replace it with a default value.
>I was thinking something like the following but I know it's wrong:
>
>REPLACE ALL table.field with "default_value" where table.field=""

The problem here is that, if you have SET EXACT OFF, all fields will meet the condition. If you have SET EXACT ON, none will.

If you know that the character field has 10 spaces, you can use:

... where Field = space(10)

However, the easiest method is:

... where empty(Field)

This works for most data types! Characters with only blank, memos that are either empty or only blanks, numerics = 0, empty dates.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform