Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-15 Thread villas
Depends, but I think there would always be a difference in favour of normalized data because the data access is fully indexed. However, this difference may be almost negligible if your main table is less than say 10K records and your queries are simple. In my experience, where performance

Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-15 Thread Chris Rowson
Heh, no worries. :-) I wonder, just out of interest, is there any great performance difference between searching for records containing region.id 'x' (as below) rather than returning all rows with region.id 'x' from a junction table? Chris On Sat, Apr 14, 2012 at 11:34 PM, villas wrote: > Oops

Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-14 Thread villas
Oops I think I got confused with the vertical bars, try it with just a plain integer: houses = db(db.house_types.regions.contains(7)).select() On Saturday, 14 April 2012 22:33:54 UTC+1, leftcase wrote: > > Thank you again David, > > I shall give it a go. > > Chris > > On Sat, Apr 14, 2012 at 1

Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-14 Thread Chris Rowson
Thank you again David, I shall give it a go. Chris On Sat, Apr 14, 2012 at 10:29 PM, villas wrote: > Yes, it would store the ids of the regions between vertical bars, > something like this: |4|7|23|. So say you are looking for the house-types > in China (which is id = 7). It would be someth

Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-14 Thread villas
Yes, it would store the ids of the regions between vertical bars, something like this: |4|7|23|. So say you are looking for the house-types in China (which is id = 7). It would be something like this: if you already have the record id no.7, then just this: houses = db(db.house_types.regions.

Re: [web2py] Re: Multiselect form and many-to-many relationship

2012-04-14 Thread Chris Rowson
Hi David, Thanks for your reply. I did come across the list:reference option while trying to figure this out. I couldn't figure this out though: Say I add the following to my house-type table: Field('regions', 'list:reference region') If I generate a form using SQLFORM, it presents me with

[web2py] Re: Multiselect form and many-to-many relationship

2012-04-14 Thread villas
I would just mention that if you only have a few regions/housetypes, you might consider de-normalising the data and using list:reference and work with the jQuery.multiselect (if you have any problems with that, you might like to read my other thread on the topic). Best regards, David On Sat