FW: [Zope-DB] Re: How do you do update with multiple tables

Charlie Clark charlie at egenix.com
Mon May 3 11:04:06 EDT 2004


any chance of you making a tutorial for yourself and others out of this?

Your SQL is going to be something like this:

SELECT pcid FROM pctable
WHERE pcid not in (SELECT pcid FROM users)

let's call this qFreePC

If we call this in Zope in a PageTemplate we get what's called a results 
instance - basically a list of all the results.

So try this

<option tal:repeat="pc here/qFreePC"
tal:attributes="value pc/pcid"
tal:content="pc/pcid">PCID will be shown here but you might want some other 

Please print out the chapters on ZPTs in the Zope Book and read them.

Good luck!


On 2004-05-03 at 16:03:10 [+0200], Laura McCord wrote:
> I like your idea.
> >For the pc choice it would be
> >possible to have a select box on your form where the pc to be selected
> comes
> >from a ZSQL method but the value sent back to the database is an ID.
> I set my database to where the users and pcTable are connected by the
> pcid.
> Now, I am trying to figure how to use the select box like you suggested.
> I imagine that I would need to write a zsql method that will find the
> available pc's that are not tied to someone and list them in the select
> box. I am a little inexperienced at all of this so I am not sure how I
> would go about writing the select box. I know how to write a basic one
> but not one that uses a zsql method. Any suggestions or could you point
> to some examples where I can learn how to do this?
> Thanks,
Charlie Clark

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Zope-DB mailing list