RE: [Zope] ZSql Strange Error
Cesar A. K. Grossmann wrote:
Hi!
I'm trying to emulate an outter join in a Z SQL, but Zope crashes every time I try the query. ... What is wrong? What I can do to get the job done (I need to fill an multiselect with 'codigo', 'nome' from 'cad_exportacao', and if exists any 'codigo' for 'username' in 'user_codigo', the option must be selected - I tryed the "Filling MULTIPLE SELECT ... HOWTO', but it doesn't works for me, and I don't know why)?
I'm not sure why this should *crash* zope, but you can do it with a much simpler query and a little DTML coding. The following should work (UNTESTED): Z SQL Method (named sql_query): select codigo, nome, tipo from cad_exportacao; DTML Method: <select> <dtml-in sql_query> <option value="&dtml-codigo;" <dtml-if "tipo=='E'">Selected</dtml-if>> <dtml-var nome></option> </dtml-in> </select> hth, Casey D.
I'm not sure why this should *crash* zope, but you can do it with a much simpler query and a little DTML coding. The following should work (UNTESTED):
It cannot help me. I have two tables. One called cad_exportacao, and the other is called user_codigo. The table user_codigo maps every username with one or more rows at cad_exportacao. I wanna fill a SELECT input with all rows in cad_exportacao, but wanna all the records that exists for 'username' in user_codigo to be selected. There was the howto that explains how to do this at http://www.zope.org/Members/Roug/select_with_multiple, but it not works for me... []s -- César A. K. Grossmann http://members.xoom.com/ckant/
Duh, maybe I should learn to read. Maybe try this sql: select codigo, nome, case when codigo in select codigo from user_codigo where username = <dtml-sqlvar username type=string> and tipo = 'E' ) then 'selected' else null end as select_attr from cad_exportacao; Then your dtml method: <select> <dtml-in sql_method> <option value="&dtml-codigo" <dtml-var select_attr missing>><dtml-var nome></option> </dtml-in> </select> Let me know if this is any better, Casey D. -----Original Message----- From: cesar@rotnet.com.br [mailto:cesar@rotnet.com.br] Sent: Thursday, November 02, 2000 12:08 PM To: casey.duncan@state.co.us Cc: zope@zope.org Subject: Re: [Zope] ZSql Strange Error
I'm not sure why this should *crash* zope, but you can do it with a much simpler query and a little DTML coding. The following should work (UNTESTED):
It cannot help me. I have two tables. One called cad_exportacao, and the other is called user_codigo. The table user_codigo maps every username with one or more rows at cad_exportacao. I wanna fill a SELECT input with all rows in cad_exportacao, but wanna all the records that exists for 'username' in user_codigo to be selected. There was the howto that explains how to do this at http://www.zope.org/Members/Roug/select_with_multiple, but it not works for me... []s -- César A. K. Grossmann http://members.xoom.com/ckant/
Casey Duncan wrote:
Duh, maybe I should learn to read.
:-)
Let me know if this is any better,
It worked! Thanks. []s -- César A. K. Grossmann http://members.xoom.com/ckant/
participants (2)
-
Casey Duncan -
Cesar A. K. Grossmann