[Zope] sql returning number
Roger Mallett
rogermallett at hotmail.com
Thu Sep 25 16:32:22 EDT 2003
1) I think I would put the project names in a table of their own with the
key (id) set to "auto_increment", such would solve your numbering/display
problem.
[create table trash (id int not null auto_increment,...);]
Then insert like: insert into trash values (null,....); the null
causes the auto_increment to kick in.
2) use <dtml-var name="ID" sql_quote> (actually, I'm not sure whether
or not you need the "sql_quote" part, but you do need the "name=" part.
Hope this helps.
>From: "Derek S. Wilson" <dwilson at vhswest.com>
>To: <zope at zope.org>
>Subject: [Zope] sql returning number
>Date: Thu, 25 Sep 2003 13:14:15 -0700
>
>I have a slight problem... I'm working on a project management zope
>site, and I need to create a new sequential project ID for each project.
>I made a zsql statement as follows...
>
>
>
>select MAX(ID)+1 from AllProjects
>
>
>
>This gives the expected:
>
>
>
>(Maximum(ALLPROJECTS.ID))+()
>
>3
>
>
>
>I now want to take that value(3) and use it as my ID. The column name is
>ID, So, here's how I go about doing it.
>
>
>
><dtml-in getNewProjectID>
>
>Here's the ID: <dtml-var ID>
>
></dtml-in>
>
>
>
>but it keeps giving me a 'KeyError" - "ID"
>
>of course, lowercase id just shows the name of the folder that the dtml
>document is in.
>
>So, does anyone know how I can put that result into my webpage?
>
>
>
>Thanks,
>
>Derek S. Wilson
>
>
>
>
>
>*****HIPAA Confidentiality Notice*****
>The documents inside this electronic transmission contain confidential
>information belonging to the sender that is legally privileged. This
>information is intended only for the use of the individual or entity
>named above. The authorized recipient of this information is prohibited
>from disclosing this information to any other party and is required to
>destroy the information after its stated need has been fulfilled, unless
>otherwise required by law. If you are not the intended recipient, you
>are hereby notified that any disclosure, copying, distribution, or
>action taken in reliance on the contents of these documents is strictly
>prohibited. If you received this electronic transmission in error,
>please notify the sender immediately to arrange for return.
>
>
>
><< DerekS.Wilson.vcf >>
>_______________________________________________
>Zope maillist - Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>** No cross posts or HTML encoding! **
>(Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
_________________________________________________________________
Help protect your PC. Get a FREE computer virus scan online from McAfee.
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
More information about the Zope
mailing list