[Zope] DTML and SQL question...

Pavel pashah@mail.ru
Wed, 15 Nov 2000 19:35:01 +0300


good day,

create a ZSQLMethod ... let`s call it genericSQL
having your sql query in it, then do a

<dtml-if "genericSQL(_.None,_)">
   YES! There's some data!
<dtml-else>
   no records found!
</dtml-if>

in your DTML Method

not tested.
but should work.

regards.
--
pashah

-----Original Message-----
From: zope <zope@isp.lu>
To: zope@zope.org <zope@zope.org>
Date: 15 ноября 2000 г. 19:38
Subject: [Zope] DTML and SQL question...


>Hi.
>
>I want to test if there is some data in a table.
>If so, I want to perform some action, otherwise I wan't to print out a
message.
>(<dtml-if>..<dtml-else>..</dtml-if>)
>
>My SQL statement is something like:
>
>Select count(*) from my_table where my_field = something
>
>What DTML code do I need to perform that if-statement?
>
>Something like the following does not work :-(
>
><dtml-if "genericSQL(SQLStatement='Select count(*) from my_table where
>my_field = \'0\'') == 0">
>   YES! There's some data!
><dtml-else>
>   no records found!
></dtml-in>