hi all, I have an application where I have several different SQL queries I want to do but I want to use the same DTML method to render the output. I imagine that I should be able to store a reference to a ZSQLMethod in a variable like thing and set it to the right query before I call the DTML method. Otherwise it seems like I need N display functions for the N queries. How can I do this? I have moderate experience in Python and enough experience in Zope to have built a bug tracking database system entirely in DTML (no external methods or external python products). thanks Michael Wang-Helmke Play, Incorporated
The way I handle it is with <dtml-if "a==1"> SQL statement <dtml-elif "a==2"> SQL statement <dtml-elif ... <dtml-else> SQL statement </dtml-if> in the ZSQL method. A ZSQL method is basically a DTML method that can access a database adapter so you can do just about anything you would do in a regular dtml method __________________________________________________________________ Jim Sanford . Database/Web Engineer / \ / Accelerated Technology, Inc. / / 720 Oak Circle Drive East / / \ Mobile, AL 36609 / / \ Voice: 334-661-5770 fax: 334-661-5788 / \ E-Mail: jsanford@atinucleus.com Web: http://www.atinucleus.com Source Code, No Royalties, Any CPU...It just make sense ! __________________________________________________________________ ----- Original Message ----- From: Michael Wang-Helmke <mhelmke@play.com> To: <zope@zope.org> Sent: Wednesday, January 05, 2000 7:56 PM Subject: [Zope] Dynamically choosing a ZSQLMethod to run hi all, I have an application where I have several different SQL queries I want to do but I want to use the same DTML method to render the output. I imagine that I should be able to store a reference to a ZSQLMethod in a variable like thing and set it to the right query before I call the DTML method. Otherwise it seems like I need N display functions for the N queries. How can I do this? I have moderate experience in Python and enough experience in Zope to have built a bug tracking database system entirely in DTML (no external methods or external python products). thanks Michael Wang-Helmke Play, Incorporated _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi, you could try something like: --- / | |-- dtml_method | +-- folder_a | | | |-- zsql_method | +-- folder_b | |-- zsql_method and in dtml_method: <dtml-in zsql_method> ... </dtml-in> Now /folder_a/dtml_method and /folder_b/dtml_method should do what you want. ... Holger Hoffmann Michael Wang-Helmke wrote:
hi all,
I have an application where I have several different SQL queries I want to do but I want to use the same DTML method to render the output. I imagine that I should be able to store a reference to a ZSQLMethod in a variable like thing and set it to the right query before I call the DTML method. Otherwise it seems like I need N display functions for the N queries. How can I do this?
I have moderate experience in Python and enough experience in Zope to have built a bug tracking database system entirely in DTML (no external methods or external python products).
thanks
Michael Wang-Helmke Play, Incorporated
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Holger Hoffmann -
Jim Sanford -
Michael Wang-Helmke