I sincerely hope that this gets cached somewhere in your app, because if 
instead they are in models, you're doing 2 selects for every request 

On Thursday, August 1, 2013 2:21:07 PM UTC+2, Antonis Konstantinos Tzorvas 
wrote:
>
> yes you are right, i was looking also in IS_IN_SET
> and finally after your reminder one solution came up easily,
>
> IS_IN_SET([i.name for i in rows = union(db().select(db.a.name
> ),db().select(db.b.name)).sort(lambda row: row.name)])
>
> which now displays all the values of a required column from both tables!
> don't know if there is a better way to do this, or a way to use IS_IN_DB() 
> but i think that this one works
>
> On Thursday, August 1, 2013 2:48:40 PM UTC+3, viniciusban wrote:
>>
>> I don't think so. 
>>
>> The book says IS_IN_DB() can receive a Set, but not Rows. 
>>
>> On Thu, Aug 1, 2013 at 8:33 AM, Antonis Konstantinos Tzorvas 
>> <ant...@tzorvas.com> wrote: 
>> >> --- https://groups.google.com/d/msg/web2py/o3GebSeC7j4/Sct76ynB3fsJ---- 
>> >> 
>> >> db=DAL()db.define_table('a',Field('name')) 
>> >> db.define_table('b',Field('name')) 
>> >> db.a.insert(name='Alex') 
>> >> db.a.insert(name='Max') 
>> >> db.a.insert(name='Tim') 
>> >> db.b.insert(name='John') 
>> >> db.b.insert(name='Jack') 
>> >> def union(x,y): 
>> >>     y.colnames=x.colnames 
>> >>     return x|y 
>> >> 
>> >> rows = union(db().select(db.a.name),db().select(db.b.name)).sort(lambda 
>>
>> >> row: row.name) 
>> >> 
>> >> for row in rows: print row.name 
>> > 
>> > 
>> > this one worked for the union select part, 
>> > but how can i use it with a validator like IS_IN_DB for a form? 
>> > 
>> > i have two identical tables which data are from different source but 
>> the 
>> > structure is the same 
>> > 
>> > -- 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "web2py-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to web2py+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to