[Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi all,
I'm trying to basically get the output of two SELECT statements into a
dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but had no
luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Joe Bezier

I'm not sure if this is what you're looking for

dtml-in 
expr=sql_statement(parameter1=parameter1,parameter2=parameter2)

dtml-var column_name
/dtml-in

If no parameters, just expr=sql_statement() or dtml-in sql_statement

Cheers,

JB


On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:


Hi all,
I'm trying to basically get the output of two SELECT statements into a
dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but had no
luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )







___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi Joe, 
thanks for the quick reply!
i've got a zsql method now(called date_count.zsql) which I try to call
in my dtml via dtml-in date_count - but I get a KeyError when the page
is refreshed. The dtml is in the same dir as the zsql...not sure whats
up.

Cheers,
Paul

On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
 I'm not sure if this is what you're looking for
 
 dtml-in 
 expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
 dtml-var column_name
 /dtml-in
 
 If no parameters, just expr=sql_statement() or dtml-in sql_statement
 
 Cheers,
 
 JB
 
 
 On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
 
  Hi all,
  I'm trying to basically get the output of two SELECT statements into a
  dtml document, but cant get it working.
  I've searched, and tried a few examples for similar things, but had no
  luck. Can anyone recommend a way, please?
 
  Thanks,
  Paul
 
  ___
  Zope maillist  -  Zope@zope.org
  http://mail.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://mail.zope.org/mailman/listinfo/zope-announce
   http://mail.zope.org/mailman/listinfo/zope-dev )
 
 
 
   
   
   
 ___ 
 Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
 voicemail http://uk.messenger.yahoo.com
 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
sorry, i meant when i run the code - i'm not with zope terminology yet.
here's my date_count.zsql method:
select count(*) AS endcount from t_transaction

and in the dtml, i've got:
dtml-in date_count
dtml-var endcount
/dtml-in

Thanks for the replies so far!
Paul

On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
 When the page is refreshed??? It shouldn't matter. It's got to be
 something wrong with the SQL statement.
 
 A ZSQL method doesn't really have an output, you have to loop over
 it and get the output for each key in the iterations.
 
 On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi Joe,
  thanks for the quick reply!
  i've got a zsql method now(called date_count.zsql) which I try to call
  in my dtml via dtml-in date_count - but I get a KeyError when the page
  is refreshed. The dtml is in the same dir as the zsql...not sure whats
  up.
  
  Cheers,
  Paul
  
  On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
   I'm not sure if this is what you're looking for
  
   dtml-in
   expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
   dtml-var column_name
   /dtml-in
  
   If no parameters, just expr=sql_statement() or dtml-in sql_statement
  
   Cheers,
  
   JB
  
  
   On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
  
Hi all,
I'm trying to basically get the output of two SELECT statements into a
dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but had no
luck. Can anyone recommend a way, please?
   
Thanks,
Paul
   
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
   
  
  
  
  
  
   ___
   Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
   voicemail http://uk.messenger.yahoo.com
  
  
  ___
  Zope maillist  -  Zope@zope.org
  http://mail.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://mail.zope.org/mailman/listinfo/zope-announce
   http://mail.zope.org/mailman/listinfo/zope-dev )
  
 
 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
And this doesn't work when you refresh?? I find that hard to believe.
What's the error (including traceback)

On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 sorry, i meant when i run the code - i'm not with zope terminology yet.
 here's my date_count.zsql method:
 select count(*) AS endcount from t_transaction
 
 and in the dtml, i've got:
 dtml-in date_count
 dtml-var endcount
 /dtml-in
 
 Thanks for the replies so far!
 Paul
 
 On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
  When the page is refreshed??? It shouldn't matter. It's got to be
  something wrong with the SQL statement.
 
  A ZSQL method doesn't really have an output, you have to loop over
  it and get the output for each key in the iterations.
 
  On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   Hi Joe,
   thanks for the quick reply!
   i've got a zsql method now(called date_count.zsql) which I try to call
   in my dtml via dtml-in date_count - but I get a KeyError when the page
   is refreshed. The dtml is in the same dir as the zsql...not sure whats
   up.
  
   Cheers,
   Paul
  
   On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
I'm not sure if this is what you're looking for
   
dtml-in
expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
dtml-var column_name
/dtml-in
   
If no parameters, just expr=sql_statement() or dtml-in sql_statement
   
Cheers,
   
JB
   
   
On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
   
 Hi all,
 I'm trying to basically get the output of two SELECT statements into a
 dtml document, but cant get it working.
 I've searched, and tried a few examples for similar things, but had no
 luck. Can anyone recommend a way, please?

 Thanks,
 Paul

 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )

   
   
   
   
   
___
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
voicemail http://uk.messenger.yahoo.com
   
  
   ___
   Zope maillist  -  Zope@zope.org
   http://mail.zope.org/mailman/listinfo/zope
   **   No cross posts or HTML encoding!  **
   (Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
  
 
 
 
 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Joe Bezier
OK, are you using a Zope with an error_log? [you'll see it in the root 
of your installation]. If so, could you pass on the whole traceback for 
this error?


Hang on - are you calling 'date_count' when your object's called 
'date_count.zsql'? Rename your zsql method 'date_count' and then try - 
I think that should do it. If not, send us the traceback...


Cheers

JB
On 9 Sep 2005, at 11:33, [EMAIL PROTECTED] wrote:


sorry, i meant when i run the code - i'm not with zope terminology yet.
here's my date_count.zsql method:
select count(*) AS endcount from t_transaction

and in the dtml, i've got:
dtml-in date_count
dtml-var endcount
/dtml-in

Thanks for the replies so far!
Paul

On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:

When the page is refreshed??? It shouldn't matter. It's got to be
something wrong with the SQL statement.

A ZSQL method doesn't really have an output, you have to loop over
it and get the output for each key in the iterations.

On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi Joe,
thanks for the quick reply!
i've got a zsql method now(called date_count.zsql) which I try to 
call
in my dtml via dtml-in date_count - but I get a KeyError when the 
page
is refreshed. The dtml is in the same dir as the zsql...not sure 
whats

up.

Cheers,
Paul

On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:

I'm not sure if this is what you're looking for

dtml-in
expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
dtml-var column_name
/dtml-in

If no parameters, just expr=sql_statement() or dtml-in 
sql_statement


Cheers,

JB


On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:


Hi all,
I'm trying to basically get the output of two SELECT statements 
into a

dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but 
had no

luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )







___
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide 
with voicemail http://uk.messenger.yahoo.com




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )












___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi,
I've attached the two files that I'm using
Full error is this: 
  
Site Error
An error was encountered while
publishing this resource. 

KeyError

Sorry, a site error occurred.

Traceback (innermost last):

  * Module ZPublisher.Publish,
line 175, in
publish_module_standard
  * Module
Products.PlacelessTranslationService.PatchStringIO, line 51, in 
new_publish
  * Module ZPublisher.Publish,
line 132, in publish
  * Module Zope.App.startup,
line 204, in
zpublisher_exception_hook
  * Module ZPublisher.Publish,
line 101, in publish
  * Module ZPublisher.mapply,
line 88, in mapply
  * Module ZPublisher.Publish,
line 39, in call_object
  * Module
Products.CMFCore.FSDTMLMethod, line 141, in __call__
  * Module
DocumentTemplate.DT_String,
line 474, in __call__
  * Module
Products.CMFCore.FSDTMLMethod, line 134, in __call__
  * Module
DocumentTemplate.DT_String,
line 474, in __call__
  * Module
DocumentTemplate.DT_In, line
623, in renderwob
KeyError: 'sql_select_counts' 




Troubleshooting Suggestions

  * The URL may be incorrect.
  * The parameters passed to
this resource may be
incorrect.
  * A resource that this
resource relies on may be
encountering an error.

For more detailed information about
the error, please refer to error
log. 

If the error persists please contact
the site maintainer. Thank you for
your patience. 



On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
 And this doesn't work when you refresh?? I find that hard to believe.
 What's the error (including traceback)
 
 On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  sorry, i meant when i run the code - i'm not with zope terminology yet.
  here's my date_count.zsql method:
  select count(*) AS endcount from t_transaction
  
  and in the dtml, i've got:
  dtml-in date_count
  dtml-var endcount
  /dtml-in
  
  Thanks for the replies so far!
  Paul
  
  On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
   When the page is refreshed??? It shouldn't matter. It's got to be
   something wrong with the SQL statement.
  
   A ZSQL method doesn't really have an output, you have to loop over
   it and get the output for each key in the iterations.
  
   On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi Joe,
thanks for the quick reply!
i've got a zsql method now(called date_count.zsql) which I try to call
in my dtml via dtml-in date_count - but I get a KeyError when the page
is refreshed. The dtml is in the same dir as the zsql...not sure whats
up.
   
Cheers,
Paul
   
On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
 I'm not sure if this is what you're looking for

 dtml-in
 expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
 dtml-var column_name
 /dtml-in

 If no parameters, just expr=sql_statement() or dtml-in 
 sql_statement

 Cheers,

 JB


 On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:

  Hi all,
  I'm trying to basically get the output of two SELECT statements 
  into a
  dtml document, but cant get it working.
  I've searched, and tried a few examples for similar things, but had 
  no
  luck. Can anyone recommend a way, please?
 
  Thanks,
  Paul
 
  ___
  Zope maillist  -  Zope@zope.org
  http://mail.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://mail.zope.org/mailman/listinfo/zope-announce
   http://mail.zope.org/mailman/listinfo/zope-dev )
 





 ___
 Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
 voicemail http://uk.messenger.yahoo.com

   
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
   
  
  
  
  
 
 
SELECT COUNT(*) AS tcount FROM t_transaction 
dtml-comment
Despite the name of this form (it's usually used to provide a 
form wrapper around a selection screen) I am using this here
to provide a title to the page. 
/dtml-comment


table width=100%
tr
td align=center
dtml-in sql_header size=1

h1bTransactions for dtml-var PARTCODE - dtml-var KANBAN - dtml-var 
PARTDESCRIPTION - dtml-var CLIENTCODE/b/h1

dtml-if showvalue
p align=righta href=/crocus/ui/stock/transaction?pmid=dtml-var 
pmiddtml-if 

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
Like Joe said, have you confused the critical difference between
sql_select_counts and sql_select_counts.zsql


On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,
 I've attached the two files that I'm using
 Full error is this:
 
 Site Error
 An error was encountered while
 publishing this resource.
 
 KeyError
 
 Sorry, a site error occurred.
 
 Traceback (innermost last):
 
   * Module ZPublisher.Publish,
 line 175, in
 publish_module_standard
   * Module
 Products.PlacelessTranslationService.PatchStringIO, line 51, in 
 new_publish
   * Module ZPublisher.Publish,
 line 132, in publish
   * Module Zope.App.startup,
 line 204, in
 zpublisher_exception_hook
   * Module ZPublisher.Publish,
 line 101, in publish
   * Module ZPublisher.mapply,
 line 88, in mapply
   * Module ZPublisher.Publish,
 line 39, in call_object
   * Module
 Products.CMFCore.FSDTMLMethod, line 141, in __call__
   * Module
 DocumentTemplate.DT_String,
 line 474, in __call__
   * Module
 Products.CMFCore.FSDTMLMethod, line 134, in __call__
   * Module
 DocumentTemplate.DT_String,
 line 474, in __call__
   * Module
 DocumentTemplate.DT_In, line
 623, in renderwob
 KeyError: 'sql_select_counts'
 
 
 
 
 Troubleshooting Suggestions
 
   * The URL may be incorrect.
   * The parameters passed to
 this resource may be
 incorrect.
   * A resource that this
 resource relies on may be
 encountering an error.
 
 For more detailed information about
 the error, please refer to error
 log.
 
 If the error persists please contact
 the site maintainer. Thank you for
 your patience.
 
 
 
 On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
  And this doesn't work when you refresh?? I find that hard to believe.
  What's the error (including traceback)
 
  On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   sorry, i meant when i run the code - i'm not with zope terminology yet.
   here's my date_count.zsql method:
   select count(*) AS endcount from t_transaction
  
   and in the dtml, i've got:
   dtml-in date_count
   dtml-var endcount
   /dtml-in
  
   Thanks for the replies so far!
   Paul
  
   On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
When the page is refreshed??? It shouldn't matter. It's got to be
something wrong with the SQL statement.
   
A ZSQL method doesn't really have an output, you have to loop over
it and get the output for each key in the iterations.
   
On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi Joe,
 thanks for the quick reply!
 i've got a zsql method now(called date_count.zsql) which I try to call
 in my dtml via dtml-in date_count - but I get a KeyError when the 
 page
 is refreshed. The dtml is in the same dir as the zsql...not sure whats
 up.

 Cheers,
 Paul

 On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
  I'm not sure if this is what you're looking for
 
  dtml-in
  expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
  dtml-var column_name
  /dtml-in
 
  If no parameters, just expr=sql_statement() or dtml-in 
  sql_statement
 
  Cheers,
 
  JB
 
 
  On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
 
   Hi all,
   I'm trying to basically get the output of two SELECT statements 
   into a
   dtml document, but cant get it working.
   I've searched, and tried a few examples for similar things, but 
   had no
   luck. Can anyone recommend a way, please?
  
   Thanks,
   Paul
  
   ___
   Zope maillist  -  Zope@zope.org
   http://mail.zope.org/mailman/listinfo/zope
   **   No cross posts or HTML encoding!  **
   (Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
  
 
 
 
 
 
  ___
  Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide 
  with voicemail http://uk.messenger.yahoo.com
 

 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )

   
   
  
  
 
 
 
 
 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Ok, I've made a few changes, and now I get this error: 

Site Error
An error was encountered while publishing this resource. 

AttributeError

Sorry, a site error occurred.

Traceback (innermost last):

  * Module ZPublisher.Publish, line 175, in publish_module_standard
  * Module Products.PlacelessTranslationService.PatchStringIO, line
51, in new_publish
  * Module ZPublisher.Publish, line 132, in publish
  * Module Zope.App.startup, line 204, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 101, in publish
  * Module ZPublisher.mapply, line 88, in mapply
  * Module ZPublisher.Publish, line 39, in call_object
  * Module Products.CMFCore.FSDTMLMethod, line 141, in __call__
  * Module DocumentTemplate.DT_String, line 474, in __call__
  * Module Products.CMFCore.FSDTMLMethod, line 134, in __call__
  * Module DocumentTemplate.DT_String, line 474, in __call__
  * Module DocumentTemplate.DT_In, line 676, in renderwob
  * Module AccessControl.ImplPython, line 164, in guarded_getitem
  * Module AccessControl.ZopeGuards, line 67, in guarded_getitem
AttributeError: __getitem__


On Fri, 2005-09-09 at 11:55 +0100, Peter Bengtsson wrote:
 Like Joe said, have you confused the critical difference between
 sql_select_counts and sql_select_counts.zsql
 
 
 On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi,
  I've attached the two files that I'm using
  Full error is this:
  
  Site Error
  An error was encountered while
  publishing this resource.
  
  KeyError
  
  Sorry, a site error occurred.
  
  Traceback (innermost last):
  
* Module ZPublisher.Publish,
  line 175, in
  publish_module_standard
* Module
  Products.PlacelessTranslationService.PatchStringIO, line 51, in 
  new_publish
* Module ZPublisher.Publish,
  line 132, in publish
* Module Zope.App.startup,
  line 204, in
  zpublisher_exception_hook
* Module ZPublisher.Publish,
  line 101, in publish
* Module ZPublisher.mapply,
  line 88, in mapply
* Module ZPublisher.Publish,
  line 39, in call_object
* Module
  Products.CMFCore.FSDTMLMethod, line 141, in __call__
* Module
  DocumentTemplate.DT_String,
  line 474, in __call__
* Module
  Products.CMFCore.FSDTMLMethod, line 134, in __call__
* Module
  DocumentTemplate.DT_String,
  line 474, in __call__
* Module
  DocumentTemplate.DT_In, line
  623, in renderwob
  KeyError: 'sql_select_counts'
  
  
  
  
  Troubleshooting Suggestions
  
* The URL may be incorrect.
* The parameters passed to
  this resource may be
  incorrect.
* A resource that this
  resource relies on may be
  encountering an error.
  
  For more detailed information about
  the error, please refer to error
  log.
  
  If the error persists please contact
  the site maintainer. Thank you for
  your patience.
  
  
  
  On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
   And this doesn't work when you refresh?? I find that hard to believe.
   What's the error (including traceback)
  
   On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
sorry, i meant when i run the code - i'm not with zope terminology yet.
here's my date_count.zsql method:
select count(*) AS endcount from t_transaction
   
and in the dtml, i've got:
dtml-in date_count
dtml-var endcount
/dtml-in
   
Thanks for the replies so far!
Paul
   
On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
 When the page is refreshed??? It shouldn't matter. It's got to be
 something wrong with the SQL statement.

 A ZSQL method doesn't really have an output, you have to loop over
 it and get the output for each key in the iterations.

 On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi Joe,
  thanks for the quick reply!
  i've got a zsql method now(called date_count.zsql) which I try to 
  call
  in my dtml via dtml-in date_count - but I get a KeyError when the 
  page
  is refreshed. The dtml is in the same dir as the zsql...not sure 
  whats
  up.
 
  Cheers,
  Paul
 
  On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
   I'm not sure if this is what you're looking for
  
   dtml-in
   expr=sql_statement(parameter1=parameter1,parameter2=parameter2)
   dtml-var column_name
   /dtml-in
  
   If no parameters, just expr=sql_statement() or dtml-in 
   sql_statement
  
   Cheers,
  
   JB
  
  
   On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
  
Hi all,
I'm trying to basically get the output of two SELECT statements 
into 

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
Try to locate what causes this error by commenting things out one by
one. Eventually you'll be able to locate the culprit which someone on
the list might be able to help you with.

On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Ok, I've made a few changes, and now I get this error:
 
 Site Error
 An error was encountered while publishing this resource.
 
 AttributeError
 
 Sorry, a site error occurred.
 
 Traceback (innermost last):
 
   * Module ZPublisher.Publish, line 175, in publish_module_standard
   * Module Products.PlacelessTranslationService.PatchStringIO, line
 51, in new_publish
   * Module ZPublisher.Publish, line 132, in publish
   * Module Zope.App.startup, line 204, in zpublisher_exception_hook
   * Module ZPublisher.Publish, line 101, in publish
   * Module ZPublisher.mapply, line 88, in mapply
   * Module ZPublisher.Publish, line 39, in call_object
   * Module Products.CMFCore.FSDTMLMethod, line 141, in __call__
   * Module DocumentTemplate.DT_String, line 474, in __call__
   * Module Products.CMFCore.FSDTMLMethod, line 134, in __call__
   * Module DocumentTemplate.DT_String, line 474, in __call__
   * Module DocumentTemplate.DT_In, line 676, in renderwob
   * Module AccessControl.ImplPython, line 164, in guarded_getitem
   * Module AccessControl.ZopeGuards, line 67, in guarded_getitem
 AttributeError: __getitem__
 
 
 On Fri, 2005-09-09 at 11:55 +0100, Peter Bengtsson wrote:
  Like Joe said, have you confused the critical difference between
  sql_select_counts and sql_select_counts.zsql
 
 
  On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   Hi,
   I've attached the two files that I'm using
   Full error is this:
  
   Site Error
   An error was encountered while
   publishing this resource.
  
   KeyError
  
   Sorry, a site error occurred.
  
   Traceback (innermost last):
  
 * Module ZPublisher.Publish,
   line 175, in
   publish_module_standard
 * Module
   Products.PlacelessTranslationService.PatchStringIO, line 51, in 
   new_publish
 * Module ZPublisher.Publish,
   line 132, in publish
 * Module Zope.App.startup,
   line 204, in
   zpublisher_exception_hook
 * Module ZPublisher.Publish,
   line 101, in publish
 * Module ZPublisher.mapply,
   line 88, in mapply
 * Module ZPublisher.Publish,
   line 39, in call_object
 * Module
   Products.CMFCore.FSDTMLMethod, line 141, in __call__
 * Module
   DocumentTemplate.DT_String,
   line 474, in __call__
 * Module
   Products.CMFCore.FSDTMLMethod, line 134, in __call__
 * Module
   DocumentTemplate.DT_String,
   line 474, in __call__
 * Module
   DocumentTemplate.DT_In, line
   623, in renderwob
   KeyError: 'sql_select_counts'
  
  
   
  
   Troubleshooting Suggestions
  
 * The URL may be incorrect.
 * The parameters passed to
   this resource may be
   incorrect.
 * A resource that this
   resource relies on may be
   encountering an error.
  
   For more detailed information about
   the error, please refer to error
   log.
  
   If the error persists please contact
   the site maintainer. Thank you for
   your patience.
  
  
  
   On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
And this doesn't work when you refresh?? I find that hard to believe.
What's the error (including traceback)
   
On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 sorry, i meant when i run the code - i'm not with zope terminology 
 yet.
 here's my date_count.zsql method:
 select count(*) AS endcount from t_transaction

 and in the dtml, i've got:
 dtml-in date_count
 dtml-var endcount
 /dtml-in

 Thanks for the replies so far!
 Paul

 On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
  When the page is refreshed??? It shouldn't matter. It's got to be
  something wrong with the SQL statement.
 
  A ZSQL method doesn't really have an output, you have to loop over
  it and get the output for each key in the iterations.
 
  On 9/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   Hi Joe,
   thanks for the quick reply!
   i've got a zsql method now(called date_count.zsql) which I try to 
   call
   in my dtml via dtml-in date_count - but I get a KeyError when 
   the page
   is refreshed. The dtml is in the same dir as the zsql...not sure 
   whats
   up.
  
   Cheers,
   Paul
  
   On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
I'm not sure if this is what you're looking for
   
dtml-in