Subject Re: DBF level 4 to 7 Problem
From Mervyn Bick <invalid@invalid.invalid>
Date Tue, 14 Mar 2017 09:48:12 +0200
Newsgroups dbase.getting-started

On 2017-03-14 9:31 AM, WJS wrote:
> On 2017/03/13 11:19 PM, Peter wrote:
>> ......
>> Thank your both for your quick responses.
>> About a year ago I changed another dbf from level 4 to 7, and got
>> messed up math with a numeric field becoming null instead of zero.
>> Mervyn saved the day with a short and highly effective program to
>> replace a numeric field with a null value to 0.00.  Will give it a
>> try.  Certainly sounds like that is the problem.
>> Will report back.
>> Peter
>>
>
> Don't know Mervyn's solution but just FWIW:
> You can also use local sql directly e.g.
>
> update <tableName> set <fieldName1> = <value>, <fieldName2> = <value>
> where (<fieldName> IS NULL OR <fieldName2> IS NULL)
>

I can't remember what I had for lunch yesterday so it's no wonder I
can't recall what I posted a year ago. :-)

Be careful with this.  As it stands that line of code could have
unexpected results.

If both fields are null there isn't a problem but if fieldname1
contains, say 15.00 and fieldname2 is null the code will set BOTH fields
to 0.00 (or whatever value has been assigned to the specific field).

It would be better to do one field at a time.

  update <tableName> set <fieldName1> = <value> where (<fieldName1> IS NULL)

update <tableName> set <fieldName2> = <value> where (<fieldName2> IS NULL)