Yes, thanks, you'r right.
With you'r method, it's simple ;)
And you can make AND condition :
query &= db.mytable.tag == tag
OR condition :
query |= db.mytable.tag == tag
It's exactly what i'm seeking!
You'r solution, and Bruno's one, are perfect,
I hope that can help someone else,
Have a nice
On Friday, February 10, 2012 6:19:09 PM UTC-5, gbs wrote:
>
> I have try the solution of anthony, but i don't have the skill in
> python to success..
> (some error with 'Rows' object has no attribute 'select', etc ;)
>
Once the query has been built, this should work:
rows = db(query).select()
I have try the solution of anthony, but i don't have the skill in
python to success..
(some error with 'Rows' object has no attribute 'select', etc ;)
But it's my fault,
Thanks again
On 10 fév, 23:43, gbs wrote:
> Thanks to all.
>
> I have test the first answer, from Bruno..
>
> It's work!
>
>
On Friday, February 10, 2012 5:35:50 PM UTC-5, Detectedstealth wrote:
>
> sql = db
> -- if tag :
> sql = sql(db.mytable.tag = "xxx")
> -- if status:
> sql = sql(db.mytable.status = "xxx")
>
> result = sql.select()
Yes, that's nice too. It works because the Set object is callable, and
calling
Thanks to all.
I have test the first answer, from Bruno..
It's work!
Thanks a lot, i'm searching/reading during a long time!
I will test the others solutions, why i think they are more simple/
comprehensible for me :$
Best regards
ps : sorry for the language
On 10 fév, 23:18, Bruno Rocha wr
sql = db
-- if tag :
sql = sql(db.mytable.tag = "xxx")
-- if status:
sql = sql(db.mytable.status = "xxx")
result = sql.select()
On Fri, Feb 10, 2012 at 2:25 PM, Anthony wrote:
> You could do something like:
>
> query = db.mytable.id > 0
> if tag:
> query &= db.mytable.tag == tag
> if st
You could do something like:
query = db.mytable.id > 0
if tag:
query &= db.mytable.tag == tag
if status:
query &= db.mytable.status == status
Anthony
On Friday, February 10, 2012 5:10:01 PM UTC-5, gbs wrote:
>
> Hi,
>
> i have search posts on this group, but i don't have found the solut
Oh? you think?
Ok i will test, thanks a lot!
On 10 fév, 23:18, Bruno Rocha wrote:
> > *queries=[]*
> > *if arg1 == "x": queries.append(db.table.field == x)*
> > *if arg2 == "y": queries.append(db.table.otherfield == y)*
> > *# many conditions here*
> > *query = reduce(lambda a,b:(a&b),querie
I know that you can do :
result = db((db.xxx.tag==tag) & (db.xxx.status==status)).select()
But i don't know how to generate the condition, one by one...
On 10 fév, 23:10, gbs wrote:
> Hi,
>
> i have search posts on this group, but i don't have found the solution
> of my question :$
>
> I ha
9 matches
Mail list logo