Subject Re: DBF level 4 to 7 Problem
From Peter <phb2020@hotmail.com>
Date Mon, 13 Mar 2017 17:19:34 -0400
Newsgroups dbase.getting-started

Akshat Kapoor Wrote:

> On 13/03/2017 20:49, Ken Mayer wrote:
> > On 3/13/2017 7:48 AM, Peter wrote:
> >> I have a new problem that you might be able to assist me with.  I
> >> have a program for my medical office billing.  All the various
> >> databases are level 7, except for the main file of patient info
> >> (name, address, date of birth, insurance info, etc.) which is level
> >> 4, from my days with dBase IV.  When I recently converted this main
> >> file to level 7 by adding a new field, a problem arose.  After
> >> selecting a patient via a browse (not grid), subsequent forms use
> >> datalinks with memory variables which are made public in first screen
> >> (from era of dBase IV).  But form does not show entryfield with
> >> patient last name, title, first name and middle initial. (ie
> >> trim(mlname)+", "+trim(mfname)+" " +mmi) Everything else shows
> >> correctly.  Similar problem with printing of a billing statement.  If
> >> I go back to level 4 file that I had backed up, all is well.  If I
> >> exit program and from command window I type "display memory", all
> >> memory variables have correct data!  Running visual dBase 7.01 (yeah
> >> I know!), windows 7 Pro and Windows 10 on 2 computers. Strange.  Not
> >> sure I really need to use level 7 dbf.  I don't use auto-increment
> >> field.  But your help would be appreciated.
> >
> > Peter, the odds are that you are getting null values for empty fields.
> >
> > So, if there is no middle initial, for example, then:
> >
> > trim(mlname)+", "+trim(mfname)+" " +mmi
> >
> > Would return null, because anything+null = null.
> >
> > The fast solution:
> >
> > SET AUTONULLFIELDS OFF
> >
> > And if you are using OODML, you might want to set the rowset's
> > autonullfields property to false. (form.rowset.autonullfields := false)
> >
> > In order to deal with existing data, you can pass values through the
> > string object, which seems weird, but the string object will return an
> > empty string ("") instead of a null:
> >
> > trim( new string( mlname ) ) + ...
> >
> > (repeat for each of the fields)
>
> Use the following code on your level 7 table (after creating a backup)
> It is a short code in xdml but should function well.
> Please note that it is untested. But I had also faced a similar problem
> while converting from foxpro to dbase and did a similar procedure.
>
> /*
> replace ????? with your table name
> replace field1,field2 with your field names.
> add a line for each field of your table
> replace " " , 0 with whatever data you want to be there if the field is
> null.
> */
> use ???????
> go top
> scan while not eof()
>         repl field1 with iif(field1=null ," ", field1)
>         repl field2 with iif(field2=null ,0, field2)
> endscan
> use
>
> Regards
> Akshat

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