[Zope] ZSql Strange Error

Casey Duncan casey.duncan@state.co.us
Thu, 2 Nov 2000 10:37:37 -0700


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.