Home > Archive > Programming with dBASE > April 2005 > autonullfields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author autonullfields
Nico Oudshoorn

2005-04-09, 8:23 pm

Can I use autonullfields in +, -, * and / operations? In my application I
first have to check for an empty field and if not the operation gives the
right result, but if yes the result is inpredictable.

I have coverted from dBase 5 for Dos to 2.21 via append from and since than
I have the above problems. In 2.21 the tables are level 7. Do I maybe have
to use another level?

Nico Oudshoorn.


Rick Gearardo

2005-04-09, 8:23 pm

Autonullfields does not work with append from. A lot of us use a small
program after appending to set the null values to something else.

*killnulls.prg
q = new query()
q.sql = "select * from sercontn"
q.active = true
q.rowset.first()
do while .not. q.rowset.EndOfSet
for i = 1 to q.rowset.fields.size
if q.rowset.fields[i].fieldName <> "_DBASELOCK"
if q.rowset.fields[i].value = NULL
if q.rowset.fields[i].type = "CHARACTER"
q.rowset.fields[i].Value = ""
elseif q.rowset.fields[i].type = "NUMERIC"
q.rowset.fields[i].Value = 0
elseif q.rowset.fields[i].type = "LOGICAL"
q.rowset.fields[i].Value = false
elseif q.rowset.fields[i].type = "DATE"
q.rowset.fields[i].Value = ctod(" / / ")
endif
endif
q.rowset.Save()
endif
next
q.rowset.Next()
enddo
msgbox("done")

or you can test in your app

if r.fields["myfields"].value = null
r.fields["myfields"].value := ""
endif

Rick

> Can I use autonullfields in +, -, * and / operations? In my application I
> first have to check for an empty field and if not the operation gives the
> right result, but if yes the result is inpredictable.
>
> I have coverted from dBase 5 for Dos to 2.21 via append from and since
> than I have the above problems. In 2.21 the tables are level 7. Do I maybe
> have to use another level?



Nico Oudshoorn

2005-04-09, 8:23 pm

Thanks, I think I use the small program.

"Rick Gearardo" < dbase@NO_SPAMsecurit
ycorp.com> schreef in bericht
news:xPkIhEGPFHA.1528@news-server...
> Autonullfields does not work with append from. A lot of us use a small
> program after appending to set the null values to something else.
>
> *killnulls.prg
> q = new query()
> q.sql = "select * from sercontn"
> q.active = true
> q.rowset.first()
> do while .not. q.rowset.EndOfSet
> for i = 1 to q.rowset.fields.size
> if q.rowset.fields[i].fieldName <> "_DBASELOCK"
> if q.rowset.fields[i].value = NULL
> if q.rowset.fields[i].type = "CHARACTER"
> q.rowset.fields[i].Value = ""
> elseif q.rowset.fields[i].type = "NUMERIC"
> q.rowset.fields[i].Value = 0
> elseif q.rowset.fields[i].type = "LOGICAL"
> q.rowset.fields[i].Value = false
> elseif q.rowset.fields[i].type = "DATE"
> q.rowset.fields[i].Value = ctod(" / / ")
> endif
> endif
> q.rowset.Save()
> endif
> next
> q.rowset.Next()
> enddo
> msgbox("done")
>
> or you can test in your app
>
> if r.fields["myfields"].value = null
> r.fields["myfields"].value := ""
> endif
>
> Rick
>
>
>



Nico Oudshoorn

2005-04-15, 7:23 am

In my opinion yuo can optimize this program by saving before the
q.rowset.next. Is that correct?

Nico.

"Rick Gearardo" < dbase@NO_SPAMsecurit
ycorp.com> schreef in bericht
news:xPkIhEGPFHA.1528@news-server...
> Autonullfields does not work with append from. A lot of us use a small
> program after appending to set the null values to something else.
>
> *killnulls.prg
> q = new query()
> q.sql = "select * from sercontn"
> q.active = true
> q.rowset.first()
> do while .not. q.rowset.EndOfSet
> for i = 1 to q.rowset.fields.size
> if q.rowset.fields[i].fieldName <> "_DBASELOCK"
> if q.rowset.fields[i].value = NULL
> if q.rowset.fields[i].type = "CHARACTER"
> q.rowset.fields[i].Value = ""
> elseif q.rowset.fields[i].type = "NUMERIC"
> q.rowset.fields[i].Value = 0
> elseif q.rowset.fields[i].type = "LOGICAL"
> q.rowset.fields[i].Value = false
> elseif q.rowset.fields[i].type = "DATE"
> q.rowset.fields[i].Value = ctod(" / / ")
> endif
> endif
> q.rowset.Save()
> endif
> next
> q.rowset.Next()
> enddo
> msgbox("done")
>
> or you can test in your app
>
> if r.fields["myfields"].value = null
> r.fields["myfields"].value := ""
> endif
>
> Rick
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com