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

Laura McCord Laura.McCord at doucet-austin.com
Mon May 3 11:06:54 EDT 2004


Thanks for helping me start this.

>any chance of you making a tutorial for yourself and others out of
this?
 if I did where would it be available for others? Because after I am
done putting this bad boy together I wouldn't mind giving back to the
list by producing a tutorial. 


Thanks,
 Laura

-----Original Message-----
From: Charlie Clark [mailto:charlie at egenix.com] 
Sent: Monday, May 03, 2004 10:04 AM
To: Laura McCord
Cc: zope-db at zope.org
Subject: RE: FW: [Zope-DB] Re: How do you do update with multiple tables


Laura,

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

<SELECT>
<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 
data</option>
</SELECT>

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

Good luck!

Charlie

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,
>  LAURA
-- 
Charlie Clark
eGenix.com

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