[Zope-CMF] Help on catalog query

Gitte Wange gitte@mmmanager.org
Fri, 15 Mar 2002 15:42:07 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_00A7_01C1CC37.F6903CC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,=20

I want to create some dynamic portal_catalog querys based on different =
portal types ...=20

I want to have a query that fetches all the 'event_like' objects =
(because they have the start_date property) and all other properties =
from there Date property ...=20

It's no problem making one query ..=20
But how do I make a loop that fetches some results and then adds the =
results to a variabel to I can return only on catalog result ?
I have tried with:
result =3D ''
for type in types:
    res =3D catalog.searchResults(some parameters)
    result =3D result + res

but that gave me an error (something with bad operator '+') ..=20
Then I tried with:

result =3D []
for type in types:
    res =3D catalog.searchResults(some parameters)
    result.append(res)

But that didn't return anything useful ..=20
Isn't there some way to join results from querys ?

TIA,
Gitte Wange

------=_NextPart_000_00A7_01C1CC37.F6903CC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to create some dynamic =
portal_catalog querys=20
based on different portal types ... </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want to have a query that fetches all =
the=20
'event_like' objects (because they have the start_date property) and all =
other=20
properties from there Date property ... </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It's no problem making one query .. =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>But how do I make a loop that fetches =
some results=20
and then adds the results to a variabel to I can return only on catalog =
result=20
?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have tried with:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>result =3D ''</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>for type in types:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; res =3D =
catalog.searchResults(some=20
parameters)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; result =3D result +=20
res</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>but that gave me an error (something =
with bad=20
operator '+') .. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Then I&nbsp;tried with:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2>result =3D []</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>for type in types:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; res =3D =
catalog.searchResults(some=20
parameters)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
result.append(res)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But that didn't return anything useful =
..=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Isn't there some way to join results =
from querys=20
?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>TIA,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Gitte =
Wange</FONT></DIV></DIV></BODY></HTML>

------=_NextPart_000_00A7_01C1CC37.F6903CC0--