Richard, I have read the book and tried most of the examples and use SQLFORM.smartgrid() on many of my tables. The challenge I am having is I only want select records to be returned based on a users search and I guess I didn't understand the syntax well enough. I'll play around with it. Thank you so much for your help!
On Tuesday, April 29, 2014 10:17:36 AM UTC-4, Richard wrote: > > > You can... Though you iterate twice for notting... > > SQLFORM is an API for creating self submitting form. What you probably > want if you display many records is a grid or a table (html table finally). > SQLFORM.grid() have been created for that. It's more difficult to start > using it than crud.select() though crud.select() will be depreacated > someday and you should use SQLFORM.grid in prod. But I suggest you to start > with crud.select() it will help you to get results faster. > > You need to read the book and try the example, everythings is there and > there is planty of example to work with. I suggest you to pratice then > apply the concept to your particular case in order to make sure you better > understand what you do and how to acheive it. > > Richard > > > On Tue, Apr 29, 2014 at 10:07 AM, LoveWeb2py <atayl...@gmail.com<javascript:> > > wrote: > >> Okay i'll give that a try. So I'll iterate through my list first and then >> use that clause? >> >> For id in records: >> [row.id for row in db(db.search_queries == id).select(db.table.id)] >> ?? Put something like that into the controller as SQLFORM and it will >> return those records? This is so awesome! >> >> >> On Tuesday, April 29, 2014 10:04:40 AM UTC-4, Richard wrote: >> >>> This should return a list of ids : >>> >>> [row.id for row in db(SQL WHERE CLAUSE).select(db.table.id)] >>> >>> Richard >>> >>> >>> On Tue, Apr 29, 2014 at 10:02 AM, LoveWeb2py <atayl...@gmail.com> wrote: >>> >>>> Thank you, Richard! This is great. How could I pass the parameters from >>>> a list though? I'm still learning the DAL. So if I have 6 records I want >>>> to >>>> return with the id in the list [1,2,5,7,204] >>>> >>>> How could I do that? Any code example would help. >>>> >>>> On Tuesday, April 29, 2014 9:58:03 AM UTC-4, Richard wrote: >>>> >>>>> Sure! >>>>> >>>>> Custom : >>>>> You create a form (with SQLFORM) to get what the user want to know >>>>> that gonna be the parameters of your search... Then you make a query >>>>> (db(db.table.field_in_which_you_search == the_parameters_you_get_by_ >>>>> your_form).select(db.table.ALL), you create a grid with the results >>>>> of the search... >>>>> >>>>> Web2py built-in with SQLFORM.grid() >>>>> You can also use SQLFORM.grid() that will display a grid with a few >>>>> records (inline) and there is a built-in query builder and search >>>>> field... >>>>> If you input your creteria in the field something like >>>>> "db.table.field_you_want_to_search_in == your_creteria you" will get >>>>> the records that correspond to you creteria if any. >>>>> >>>>> If you only want a list of ids for internal use in another function >>>>> the custom way is maybe more what you want... But if you build this list >>>>> just to get the record and want to display them latter you should think >>>>> to >>>>> use SQLFORM.grid that provide all what you want as far as I understand >>>>> what >>>>> you need. >>>>> >>>>> Richard >>>>> >>>>> >>>>> >>>>> On Tue, Apr 29, 2014 at 9:27 AM, LoveWeb2py <atayl...@gmail.com>wrote: >>>>> >>>>>> >>>>>> Hello, >>>>>> >>>>>> I'm trying to create a search function that allows users to search >>>>>> the database without accessing the SQLFORM. >>>>>> >>>>>> Is there a good way to display multiple results based on the record >>>>>> id? Could I create a unique SQLFORM view just on the record IDs that are >>>>>> retrieved? >>>>>> >>>>>> Basically my search goes through and checks their search against a >>>>>> huge database. If their search hits on something in the database I >>>>>> append >>>>>> the record ID to a list. >>>>>> >>>>>> Records = [1,2,5,7,204] >>>>>> >>>>>> Is there a way for me to only show those records to them? >>>>>> >>>>>> -- >>>>>> Resources: >>>>>> - http://web2py.com >>>>>> - http://web2py.com/book (Documentation) >>>>>> - http://github.com/web2py/web2py (Source code) >>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>>>> --- >>>>>> 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/d/optout. >>>>>> >>>>> >>>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> 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/d/optout. >>>> >>> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> 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 <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.