I will give a very simplified example of my task (pl. excuse me if it
is still verbose).

A form deals with "Automobile Vehicle Models - Warranty Master".
It displays the model names (of vehicles).
User selects a model to modify warranty details.
The form displays : 1) select basic warranty and 2) select extended
warranty.

Vehicle model master--
db.define_table('mdl',
              Field('mdlid','id'),
              Field('mdlnm',unique=True),
              format='%(mdlnm)s')

Basic warranty master--
db.define_table('wr',
              Field('wrid', 'id'),
              Field('wrnm',unique=True),
              format='%(wrnm)s')

Extended warranty master--
db.define_table('extwr',
              Field('extwrid', 'id'),
              Field('extwrnm',unique=True),
              format='%(extwrnm)s')
(these tables are filled from separate forms)

In our form, the user may add/edit/delete data in these tables through
a single form--

Table for recording modelwise basic warranty--
db.define_table('mdlwr',
              Field('mdlwrid','id'),
              Field('mdlid',db.mdl),
              Field('wrid', db.wr)

Table for recording modelwise extended warranty--
db.define_table('mdlextwr',
              Field('mdlextwrid','id'),
              Field('mdlid',db.mdl),
              Field('extwrid', db.extwr)

(why 2 tables when 1 would be sufficient? because these are required
for normalizing MySQL table-structures)

If any further explanation of my task is required, pl. tell me.

Thanks,

Vineet
=============================================================================

On May 11, 12:21 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Can you make a concrete example? to some extend you can do this but in
> order to be general, it requires some programming. Provide an example
> I can can show I would do it.
>
> On May 10, 12:26 pm, Vineet <vineet.deod...@gmail.com> wrote:

>
> > Hi,
> > I have a task related to the below-referred thread (but with a
> > different requirement).
> > I havemultipleMySQL tables to be tackled in one form.
> > The user will make changes to certain fields.
> > As a result,
> > table1 might require : insert or update or delete or no operation;
> > table2 might require : insert or update or delete or no operation;
> > table3 might require : insert or update or delete or no operation;
>
> > I can't predict as to whattablewill require which operation.
> > So it's not possible to hardcode the operation like
> > form[0].insert(2,TR.......etc.
>
> > (In VFP, I am using a class called as CursorAdaptor (a visual DAL tool
> > out there), which monitors these operations on tables and executes
> > them to the database).
>
> > A similar functionality would be of a great value to me inweb2py.
>
> > Is there any way to achieve this inweb2py?
>
> > Thanks in advance for your advice.
>
> > Vineet.
> > ================================================
>
> > On Nov 21 2008, 7:05 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > You have the option of using form=SQLFORM and then form[0].insert(2,TR
> > > (...)) the rows from the othertable.
> > > It may be easier to create the form using form_factory.
>
> > > Massimo
>
> > > On Nov 21, 12:34 am, mmstud <mms...@gmail.com> wrote:
>
> > > > Im thinking to create an insert and update form with fields taken from
> > > >multipletables. Person has address, email and phone instances on
> > > > separate tables, but for simple interaction, they should be present on
> > > > same form view. What is the best way to solve this kind of situation
> > > > at the moment, does SQLFORM the job?
>
> > > > On update form there would be combobox with input and selectbox
> > > > combined. Input for new email, address, phone entries and select for
> > > > possible older entries.
>
> > > > -Marko

Reply via email to