[Fwd: [Fwd: Re: [Zope-DB] Need help passing table data as
a variable to next SQL method]]
phil at xfr.co.uk
Mon Oct 11 13:22:09 EDT 2004
Gil Pangilinan wrote:
> The dilemma I'm in is that my initial query of companies alone is
> tremendous, over 500. To list the employees in the same table is just
> not an option. What I've been experimenting with is to make the company
> name in the table a hyperlink. But the troubles I'm having is passing
> the company name, id, and a couple other variables into another SQL
> method as arguments. The method itself works fine, when I test it in
> zope it creates the 4 fields that need input. The furthest I've gone is
> to get the hyperlink working to a ZSQL search interface but again, the
> user needs to input the data manually which is very troublesome. I'm
> trying to figure out how to automate this process. This would help the
> user navigating the DB so that he could just click on the company and
> see the branches, and then click on a specific branch and then see the
> employees there. (Yes, I'm trying to do various levels of this.)
Not sure if I understand you right: -
- You want a searchable list of companies (which you have?).
- You want the user to be able to click on a hyperlink in this list.
- You want the target of the hyperlink to be a company page, listing the
employees of that company?
- The issue is passing the parameters from the companies page to the
company employees page?
You can pass the parameters you need in the request, so you need to form
a link in the companies page that points to, say: -
The parameter (Company=123) is then available to the ZSQL method
providing data to the target page.
The ZSQL might look like: -
select * from COMPANY
Company = <dtml-sqlvar expr="REQUEST.form['Company']" type="int">
(Needless to say, you can pass multiple parameters this way - and you
could use a form with a POST rather than a link if you don't want all
the parameters in the URL)
Docs for the magic of ZSQL methods (and there is a lot of magic!) are at: -
Does this sound helpful? Not sure if this is what you were after, or if
I'm missing the point of the problem!
Email: phil at xfr.co.uk / Voicemail & Facsimile: 07092 070518
"Work as if you lived in the early days of a better nation." - Alasdair Gray
More information about the Zope-DB