[Zope-DB] UID - get result from ZSQL from within Py Script
Rob Dunfey
robsroom at hotmail.com
Tue Nov 4 06:18:27 EST 2003
Hello List Members,
I am trying to insert a new entry into a DB. First I need to build the a
UID. My UID involves the year e.g. '03' concatenated with the entry number
e.g.'001', a complete value for the field may look like '0301' ro '03002'
for the second entry. So to do this first I must count the number of
entries already entered for a particular year, I do this using a (count
like) '03%%' select statement. I wish to make the UID and insert it in the
DB by calling a single python script. In this script I get the current year
by using a datetime() object, then I try and call a ZSQL statement from the
script. The dateTime object successfully returns the string for example
(print dateTime.yy) prints '03' to the screen. I have tested the ZSQL
satement and it works, I pass a parameter called year as a string like
'03%%' and it works, but not from within the script?
# Return a string (year).
e=DateTime()
#print what is being passed to the screen
f = e.yy() + '%%'
print f
# Count existing Records
context.App_Count(year=f)
The above code doesnt produce any errors, but I cant get anything out of the
result objects?
Any help much appreciated,
Rob
PS If anyone knows a tidier way to make the UID 'YY_Applicant#' please guide
me.
_________________________________________________________________
Compare high-speed Internet plans, starting at $26.95.
https://broadband.msn.com (Prices may vary by service area.)
More information about the Zope-DB
mailing list