On 26/10/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have to code an extended search for a site, the search criteria can be 
> built from large groups of values which are retrieved from checkboxes. I have 
> 4 groups and each group has at least 10 checkboxes, each group result has to 
> be joined with the next to acheive the final result.
>
> My question is, how can I build such a query using the Storm ORM to search 
> tables? Some of the values in the checkboxes would be "None" so I cant have a 
> definite number of substitution Strings, and joong all of them afterwards 
> makes my head spin.
>
> Doe someone have a snippet for me on how I could acheive this?

You can build up queries using Storm's expression logic.  For
instance, if I was building a query from a search form, I might do
something like this:

    conditions = []
    if field1_values:
        conditions.append(In(Table.field1, field1_values))
    if field2_values:
        conditions.append(In(Table.field2, field2_values))
    ...
    results = store.find(Table, And(*conditions))

Is this the sort of thing you were wondering about?

James.

-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to