Hi list,
I have a database table which looks like this:
postcode_cache
------------------------
postcode (UNIQUE)
lat
lon
nearest
I want to test first whether or not a record exists for 'postcode' and
if a record does exist, I want to check whether the 'nearest' field
contains any data.
I've tried this:
if db(db.postcode_cache.postcode==postcode).select().first()==None:
create_a_new_postcode_record()
elif
db(db.postcode_cache.postcode==postcode).select(db.postcode_cache.nearest)==None:
populate_the_nearest_field()
else:
nothing_to_do()
And while the check to establish whether or not a record exists seems
to work, the check to see whether or not the 'nearest' field within
the record is populated doesn't seem to work.
Can anyone tell me what I'm doing wrong please?
Thank you,
Chris