for one, if that is your actual model, your fields have absolutely no
relationship to the other tables.
> >
> > db.define_table('order_que',
> > Field('customer_code', length=30),
> > Field('paint'),
> > Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
> > Litre', '30 Litre'])),
> > Field('pickup_time'),
> > Field('que_letter',
> > requires=IS_IN_SET([None,"A","
B","C","D","E","F"])))
needs to be
db.define_table('order_que',
Field('customer_code', length=30),
Field('paint', db.paint),
Field('que_letter', db.que_letter),
...etcetc...
)
Of course your joins would never work since they never have a relationship.
I am thinking you want all orders who have a queu letter no?
rows = db(db.order_que.que_letter != None).select()
for row in rows:
row.paint.name
row.paint.hex
row.customer_code
row.pickup_time
-Thadeus
On Wed, Jan 27, 2010 at 9:19 AM, Jason Brower <[email protected]> wrote:
> I have the paint table and the order_que...
> I wnat to join them to show only tables that have a que_letter. (Not
> none but anything else.)
> BR,
> Jason Brower
>
> On Wed, 2010-01-27 at 06:21 -0800, mdipierro wrote:
> > This is not a valid DAL query
> > plate_que = db((db.order_que.que_letter != None)==db.paint.name).select
> > ()
> > (a!=b)==c?
> >
> > can you say in words (or in SQL) what you need to do?
> >
> > Massimo
> >
> > On Jan 27, 12:49 am, Jason Brower <[email protected]> wrote:
> > > I have a database as follow:
> > > # coding: utf8
> > > from datetime import datetime, date, time
> > > now = datetime.utcnow()
> > > today = date.today()
> > >
> > > db = SQLDB('sqlite://paint.sqlite')
> > >
> > > db.define_table('order_que',
> > > Field('customer_code', length=30),
> > > Field('paint'),
> > > Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
> > > Litre', '30 Litre'])),
> > > Field('pickup_time'),
> > > Field('que_letter',
> > > requires=IS_IN_SET([None,"A","B","C","D","E","F"])))
> > >
> > > db.define_table('paint',
> > > Field('name', length=30, requires=IS_NOT_EMPTY(), unique=True),
> > > Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
> > > Field('hex_color', length=6))
> > >
> > > db.define_table('tint',
> > > Field('name', length=3, requires=IS_NOT_EMPTY()))
> > >
> > > db.define_table('paint_tints',
> > > Field('paint_id', db.paint),
> > > Field('tint_id', db.tint),
> > > Field('units', 'integer'))
> > >
> > > db.order_que.paint.requires = IS_IN_DB(db, 'paint.id', '%(name)s')
> > > db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
> > > db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
> > > db.order_que.customer_code.requires=IS_NOT_EMPTY()
> > >
> > > And I am trying to do a join like this...
> > > plate_que = db((db.order_que.que_letter != None) ==
> > > db.paint.name).select()
> > > But no matter what I put into order_que.que_letter I don't get any
> > > results. Any ideas?
> > > BR,
> > > Jason
> >
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.