I would do this:

db.define_table('numbers',
    Field('nos', 'list:integer', widget=ListStringWidget),
    Field('date', 'date',default=now)

where StringListWidget is defined here:
http://groups.google.com/group/web2py/msg/0c2600730ece873a
then

def search():
    form=SQLFORM.factory(INPUT('no1','integer'),
      INPUT('no2','integer'),
      INPUT('no3','integer'),
      INPUT('no4','integer'))
    if form.accepts(request.vars,keepvalues=True)):
      items=db(db.numbers.nos.contains(form.vars.no1)|\
            db.numbers.nos.contains(form.vars.no2)|\
            db.numbers.nos.contains(form.vars.no3)|\
            db.numbers.nos.contains(form.vars.no4)).select()
    else: items=[]
    return dict(form=form,items=items)

On Sep 11, 1:05 pm, elfuego1 <[email protected]> wrote:
> Here are some more detailed informations you asked for:
>
> The form has to search always for 4 numbers.
> The result may show 4 numbers or less (when matched).
> Position is not important.
> Search will be always for 4 numbers.
> All 4 fields have numbers. There are no empty fields in DB.
>
> On 11 Wrz, 16:19, mdipierro <[email protected]> wrote:
>
> > Will your search form accept one number or 4? Do you need to search
> > for records that have any of the numbers of all of the numbers? Are
> > the position (1,2,3,4) and the numbers important? Is 4 fixed or may
> > that increase in the future? Can the value of any of the no_x fields
> > be None or other than a number?
>
> > On Sep 11, 12:12 am, elfuego1 <[email protected]> wrote:
>
> > > Hello,
>
> > > I need to create a search form.
> > > In my DB I have fields with numbers. Now I need to look up the DB and
> > > find out if the numbers I enter are there already or not.
>
> > > db.define_table('numbers',
> > >     Field('no_1', length=18),
> > >     Field('no_2', length=18),
> > >     Field('no_3', length=18),
> > >     Field('no_4', length=18),
> > >     Field('date', 'date',default=now)
>
> > > I'd like to get two kinds of information from the DB.
> > > 1. If there is a matching record in DB:
> > >     I'd like to display all fields with matching numbers and a date
> > > when that happend (last field in DB contains a date).
> > > 2. If there is NO MATCH:
> > >     I'd like to get answer: „No matching record found”.
>
> > > Can you tell me what should I do to generate a search form with four
> > > input fields and run their contetns against my DB?
>
> > > Best regards.
>
>

Reply via email to