Werner
I came across this one, (I think)
SQL uses the variable "obj" to do the looping when looking for the
match, and there was a section of the documentation that said you
should not rely on the value of the returned variable UNLESS you check
the value of SQLCODE - the ONLY time "obj" is valid is when SQLCODE=0
so in your code you need to add an extra line.
set obj=$s(SQLCODE'=0:"",1:obj)
this ensures the correct value of obj immediately after the SQL select
statement. from then on, you can do the
if obj="" {
}
else {
}
I also tend to use the SQL syntax of "IS NULL" or "IS NOT NULL" to test
for empty fields
one last thing to check is your indices. if you add indices AFTER data
has been added, you must rebuild the index for that class otherwise the
count will be wrong.
kev