To insert/update record with .factory() you can do something like that : if form.process().accepted: if condition when update mode is not meat: id = db.underlying_table.insert(field1=form.vars.field1, ...) # You keep the id in cas you need it to insert some information in another table. elif condition when update form mode: db(db.underlying_table.record_id == request.vars.record_id).update(field1=form.vars.field1)
And you can consider a dict comprehension so you don't actually have to write too much : id = db.lotns_sample.insert(**{str(var): form.vars[var] for var in form.vars}) # You can filter form.vars to make sure you insert only the proper fields into the proper table in case you have fields from differents tables in you .factory() form. :) You can also use the web2py function to filter the field : id = db.underlying_table.insert(**db.underlying_table._filter_fields(form.vars)) Richard On Fri, Feb 14, 2014 at 9:36 AM, Anthony <abasta...@gmail.com> wrote: > SQLFORM.factory is for generating forms, not grids. > > The grid requires an actual database, though you can use a SQLite memory > database: https://groups.google.com/d/msg/web2py/g4Mon6PvNFc/jytHfEnOXTIJ. > > Anthony > > > On Friday, February 14, 2014 12:03:33 AM UTC-5, A36_Marty wrote: >> >> I would like to make a grid-like screen without an underlying database >> table. >> >> I've read the section in the book: >> http://www.web2py.com/books/default/chapter/29/07/forms- >> and-validators#SQLFORM-factory >> >> I get everything except how to create and send records to the >> SQLFORM.factory. The document mentions a table named "no_table", but how >> do I create this table without storing it in the database? >> >> Could someone provide a simple example? >> >> Also, will the SQLFORM.factory produce a grid/table or just single-record >> create/edit forms? >> >> Sorry for the elementary question, but I don't quite grasp this >> no-database concept. >> >> Thanks in advance. >> >> >> -- > 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/groups/opt_out. > -- 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/groups/opt_out.