[web2py] Re: Reverse Search with .like

2010-05-08 Thread AsmanCom
Hey Guys, that helped a lot! with a lil correction it works very nice. Thanks for the Support. On 8 Mai, 04:18, Russell russell.mcmur...@gmail.com wrote: You might want to try something like this:.     from gluon.sql import Expression     db(table1.field1.like(Expression(('%' ||

[web2py] Re: Reverse Search with .like

2010-05-07 Thread Mengu
is || just a string or have any purpose? On 7 Mayıs, 17:35, AsmanCom d.as...@web.de wrote: Hi, here is the important Code from an Sqlite trigger i use very often, is this possible with web2py to? Sqlite: (SELECT table_1.field_1 FROM table_1 WHERE '%' || NEW.field_1 || '%' LIKE

[web2py] Re: Reverse Search with .like

2010-05-07 Thread AsmanCom
The || operator is concatenate, its like + in python. On 7 Mai, 16:48, Mengu whalb...@gmail.com wrote: is || just a string or have any purpose? On 7 Mayıs, 17:35, AsmanCom d.as...@web.de wrote: Hi, here is the important Code from an Sqlite trigger i use very often, is this possible

[web2py] Re: Reverse Search with .like

2010-05-07 Thread mdipierro
This should work db('%' || NEW.field_1 || '%' LIKE table_1.field_1).select(db.table_1.field_1) On May 7, 9:35 am, AsmanCom d.as...@web.de wrote: Hi, here is the important Code from an Sqlite trigger i use very often, is this possible with web2py to? Sqlite: (SELECT table_1.field_1 FROM

[web2py] Re: Reverse Search with .like

2010-05-07 Thread AsmanCom
It returns nothing... even if I write in the exact value and it should work like a fuzzy logic.. like that: find_value= request.vars.value db('%' + table_1.field_1 + '%').lower().like(find_value).select(db.table_1.field_1) or db('%' + table_1.field_1 + '%').lower().like('%' + find_value +

[web2py] Re: Reverse Search with .like

2010-05-07 Thread AsmanCom
I´ll try to explain, I need check if any record of a given field is contained in a string. Is there any solution? On 7 Mai, 17:03, mdipierro mdipie...@cs.depaul.edu wrote: This should work db('%' || NEW.field_1 || '%'  LIKE table_1.field_1).select(db.table_1.field_1) On May 7, 9:35 am,

[web2py] Re: Reverse Search with .like

2010-05-07 Thread mdipierro
Can you try from gluon.sql import Query print db(Query( '%' || NEW.field_1 || '%' LIKE table_1.field_1 ))._select(db.table_1.field_1) Do you get the query you want? On May 7, 10:48 am, AsmanCom d.as...@web.de wrote: It returns nothing... even if I write in the exact value and it should work

[web2py] Re: Reverse Search with .like

2010-05-07 Thread Russell
You might want to try something like this:. from gluon.sql import Expression db(table1.field1.like(Expression(('%' || table2.field2 || '%').select(db.table1.field1) Not very pretty, but it does work. On May 8, 9:13 am, mdipierro mdipie...@cs.depaul.edu wrote: Can you try from