Catalog and greater then less than
Zopists, Isthere a way to search for a value in the Ctalog that is greater than/less then a given value (Especially dates) <> don't work and so I guess its not regular expression syntax. The only mention of greater than in the docs is ceil(X), and that's not quite it. Any suggestions apprecreciated. BTW, my tremendous application is running to it's feet and I have to thank the all of you who have helped me from the list, Kevin, Michel, Martjin, and others. You are what Open Source is about. All my best, -- Jason Spisak webmaster@hiretechs.com
At 22:49 21/09/99 , Jason Spisak wrote:
Zopists,
Isthere a way to search for a value in the Ctalog that is greater than/less then a given value (Especially dates) <> don't work and so I guess its not regular expression syntax. The only mention of greater than in the docs is ceil(X), and that's not quite it.
Any suggestions apprecreciated.
If your datefield is called date, use: Catalog.searchResults({'date': [ZopeTime()], 'date_usage': 'range:max'}) to get all objects with a 'date' value of maximum 'ZopeTime()'. For anything later than a given date, use :min instead, and if yo uspecify a list of dates, and specify 'range:min:max' then the highest and lowest values of your list will be used as boundaries. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Whoa. 'date_usage'? Is that something that I missed in the source? That really makes the Catalog go to that next level for me. Thanks a ton! Jason Martijn Pieters writes:
At 22:49 21/09/99 , Jason Spisak wrote:
Zopists,
Isthere a way to search for a value in the Ctalog that is greater than/less then a given value (Especially dates) <> don't work and so I guess its not regular expression syntax. The only mention of greater than in the docs is ceil(X), and that's not quite it.
Any suggestions apprecreciated.
If your datefield is called date, use:
Catalog.searchResults({'date': [ZopeTime()], 'date_usage': 'range:max'})
to get all objects with a 'date' value of maximum 'ZopeTime()'. For anything later than a given date, use :min instead, and if yo uspecify a list of dates, and specify 'range:min:max' then the highest and lowest values of your list will be used as boundaries.
-- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Jason Spisak webmaster@hiretechs.com
participants (3)
-
Jason Spisak -
Jason Spisak -
Martijn Pieters