Using result from a sql query in another query
Hello, I am having some problems on doing subject ... maybe I havent't understood the <dtml-in> and <dtml-with> tags properly but ... I need to do the following. First I need to find all specific clips belonging to a show. I do it like this: <dtml-in sqlGetShowClips> It returns a lot of records. Now for each record I need to find a servername in a server table and a filename in a filename table. The sqlGetShowClips returns some columns named serverid and fileid. I tried to do this: <dtml-with sqlGetServerName> <dtml-with sqlGetFilename> But it doesn't find anything. Is there a good explanation of how I "nest" these calls ??? I need the values to generate a URL Gitte
Sorry ... I forgot a query for the clips .. thats why I had trouble getting the serverid .. But now I have another problem. I get a KeyError on "server" ... my code looks like this: <TABLE BORDER="1" WIDTH="100%"> <TR> <TD> <dtml-in sqlGetShowClips> <dtml-in expr="sqlGetClipData(clipid=clipid)"> <dtml-with expr="sqlServeridNameQuery(serverid=serverid)"> <dtml-with expr="sqlFilenameQuery(basefile=basefileid)"> <LI><A HREF="http://<dtml-var server>/smil/<dtml-var showid>-<dtml-var clipid>" onClick="document.vid.DoPlay()"><dtml-var clipid></A> </dtml-with> </dtml-with> </dtml-in> </dtml-in> </TD> <TD> </TABLE> The <dtml-var server> is a column in the sqlServeridNameQuery .. but Zope obviously doesn't receive this column ? Any good answers? Gitte On 26 Apr 2001 13:16:45 +0200, Gitte Wange wrote:
Hello,
I am having some problems on doing subject ... maybe I havent't understood the <dtml-in> and <dtml-with> tags properly but ... I need to do the following.
First I need to find all specific clips belonging to a show. I do it like this: <dtml-in sqlGetShowClips>
It returns a lot of records. Now for each record I need to find a servername in a server table and a filename in a filename table. The sqlGetShowClips returns some columns named serverid and fileid.
I tried to do this: <dtml-with sqlGetServerName> <dtml-with sqlGetFilename>
But it doesn't find anything.
Is there a good explanation of how I "nest" these calls ??? I need the values to generate a URL
Gitte
_______________________________________________ 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 Gitte, ZSQL-Methods return lists. The list does not have the attributes of its elements so you have to specify which element you want to access. If you want the first (and in your case probably the only one) element, you have to write: <dtml-with expr="sqlServeridNameQuery(serverid=serverid)[0]"> ^^^- refers to the first element, so <dtml-with> can put its attributes on the namestack. Regards Tino --On Donnerstag, 26. April 2001 13:22 +0200 Gitte Wange <gitte@mmmanager.org> wrote:
Sorry ... I forgot a query for the clips .. thats why I had trouble getting the serverid ..
But now I have another problem. I get a KeyError on "server" ... my code looks like this: <TABLE BORDER="1" WIDTH="100%"> <TR> <TD> <dtml-in sqlGetShowClips> <dtml-in expr="sqlGetClipData(clipid=clipid)"> <dtml-with expr="sqlServeridNameQuery(serverid=serverid)"> <dtml-with expr="sqlFilenameQuery(basefile=basefileid)"> <LI><A HREF="http://<dtml-var server>/smil/<dtml-var showid>-<dtml-var clipid>" onClick="document.vid.DoPlay()"><dtml-var clipid></A> </dtml-with> </dtml-with> </dtml-in> </dtml-in> </TD> <TD> </TABLE>
The <dtml-var server> is a column in the sqlServeridNameQuery .. but Zope obviously doesn't receive this column ?
Any good answers?
Gitte
On 26 Apr 2001 13:16:45 +0200, Gitte Wange wrote:
Hello,
I am having some problems on doing subject ... maybe I havent't understood the <dtml-in> and <dtml-with> tags properly but ... I need to do the following.
First I need to find all specific clips belonging to a show. I do it like this: <dtml-in sqlGetShowClips>
It returns a lot of records. Now for each record I need to find a servername in a server table and a filename in a filename table. The sqlGetShowClips returns some columns named serverid and fileid.
I tried to do this: <dtml-with sqlGetServerName> <dtml-with sqlGetFilename>
But it doesn't find anything.
Is there a good explanation of how I "nest" these calls ??? I need the values to generate a URL
Gitte
_______________________________________________ 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 )
_______________________________________________ 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 (2)
-
Gitte Wange -
Tino Wildenhain