Discussion:
[Erp5-dev] How to search for None in catalog?
Łukasz Nowak
2007-10-23 07:49:34 UTC
Permalink
Hello,

I've got:

search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : context.getDestinationTitle()
}

Using above in portal_catalog I'm able to find all objects of given
portal_type, which has filled destination_section_title

But I'd like to extend it to find objects which has
destination_section_title set to None or '' - SQL expression:
destination_section_title = 'context.getDestinationTitle()' OR
destination_section_title = None OR
destination_section_title = ''

But creating:
search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : \
[context.getDestinationTitle(),None,'None',''] }

Is giving me:
related_catalog_1.title = 'context.getDestinationTitle()' OR
related_catalog_1.title = 'None' OR related_catalog_1.title = 'None'

So how my I search for None,'' objects properties in catalog?

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Jean-Paul Smets
2007-10-23 07:54:53 UTC
Permalink
The solution is in Query.
Jerome will tell you how to do once he has reviewed the Query API (which
he is doing right now).
JPS.
Post by Łukasz Nowak
Hello,
search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : context.getDestinationTitle()
}
Using above in portal_catalog I'm able to find all objects of given
portal_type, which has filled destination_section_title
But I'd like to extend it to find objects which has
destination_section_title = 'context.getDestinationTitle()' OR
destination_section_title = None OR
destination_section_title = ''
search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : \
[context.getDestinationTitle(),None,'None',''] }
related_catalog_1.title = 'context.getDestinationTitle()' OR
related_catalog_1.title = 'None' OR related_catalog_1.title = 'None'
So how my I search for None,'' objects properties in catalog?
Regards,
Luke
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Jérome Perrin
2007-10-23 09:24:00 UTC
Permalink
Post by Łukasz Nowak
Hello,
search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : context.getDestinationTitle()
}
Using above in portal_catalog I'm able to find all objects of given
portal_type, which has filled destination_section_title
But I'd like to extend it to find objects which has
destination_section_title = 'context.getDestinationTitle()' OR
destination_section_title = None OR
destination_section_title = ''
search_kw = {
'portal_type' : 'Sale Supply',
'destination_section_title' : \
[context.getDestinationTitle(),None,'None',''] }
related_catalog_1.title = 'context.getDestinationTitle()' OR
related_catalog_1.title = 'None' OR related_catalog_1.title = 'None'
So how my I search for None,'' objects properties in catalog?
Hi,
You can pass ignore_empty_string=0, but this will return documents for
which there is another document related with destination category, to
get documents without any documents related, it's another story.

J?rome
Łukasz Nowak
2007-10-23 09:26:51 UTC
Permalink
Hello,

On 2007-10-23, 11:24:00
Post by Jérome Perrin
Hi,
You can pass ignore_empty_string=0, but this will return documents
for which there is another document related with destination
category, to get documents without any documents related, it's
another story.
I'll wait patient for another story :)

Thanks for tips. ASAP I'll try to extend catalog related documentation
on wiki.

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Loading...