/* Original program by Mervyn Bick posted on newsgroup Small alterations by Akshat Kapoor to include more field types. Usage to remove nulls from a table Many fields have null values when converted from level 4 to level 7 Just alter the query to point at your table. Drawbacks OLE / binary fields have not been taken into consideration table name is coded and needs to be changed for every table Precaution : Create a backup of the dbf before running this program. */ clear q = new query() q.sql = "select * from '1\sales16.dbf'" q.active = true q.rowset.first() do while not q.rowset.endofset for n = 1 to q.rowset.fields.size if q.rowset.fields[n].value = null do case case q.rowset.fields[n].type = "CHARACTER" // or "N" temp = " " case q.rowset.fields[n].type $ "FN" // for float / numerical temp = 0 case q.rowset.fields[n].type = "D" // or "N" temp = ctod(" . . ") case q.rowset.fields[n].type = "L" // or "N" temp = FALSE case q.rowset.fields[n].type = "M" // or "N" temp = space(10) endcase q.rowset.beginedit() ?q.rowset.fields[n].fieldName , "*"+temp+"*" ,q.rowset.rowno() //q.rowset.fields[n].value = temp //if just checking for null values comment out the above line ?q.rowset.fields[n].value=null q.rowset.save() q.rowset.flush() endif next q.rowset.next() enddo q.active = false