It is not possible but it should be possible with a minor modification. Let me know bout this..
for now you can use rows=db(db.Assessment.InfoSys_id==db.InfoSys.id).select (db.InfoSys.ISName, db.Assessment.ALL) requites=IS_IN_SET([r.InfoSys.id for r in rows],["%s %s %s" % (r.InfoSys.ISName, r.Assessment.AssessmentStartDate, r. Assessment.Assessment.DateEnd) for r in row]) It is not that different. The only difference is that depending on where you put this, you would be doing the query even if you do no not need the validator. Massimo On Feb 15, 11:24 pm, ctalley <[email protected]> wrote: > Based on this partial model... > > db.define_table('InfoSys', > SQLField('ISName', 'string'), > SQLField('ISAbbrev', 'string'), > SQLField('ISType_id', db.ISType), > SQLField('AppQuarter_id', db.AppQuarter), > SQLField('ISOwnerType_id', db.ISOwnerType)) > > db.define_table('Assessment', > SQLField('InfoSys_id', db.InfoSys), > SQLField('AssessmentDateStart', 'date'), > SQLField('AssessmentDateEnd', 'date'), > SQLField('CAType_id', db.CAType), > SQLField('AssessmentType_id', db.AssessmentType)) > > db.define_table('Doc', > SQLField('Assessment_id', db.Assessment), > SQLField('DocList_id', db.DocList), > SQLField('DocVersionType_id', db.DocVersionType), > SQLField('ClientStatusType_id', db.ClientStatusType), > SQLField('ClientStatusDate', 'date'), > SQLField('ClientStatusNote', 'text')) > > ... assume I am adding a new Doc record through "database > administration" on the Design tab (appadmin). > > I want the Assessment_id field to be a drop down list containing three > pieces of information, all of which are in the referenced table > Assessment... > InfoSys_id > AssessmentDateStart > AssessmentDateEnd > > Now, in order to do this, I can create a validator something like > this... > > db.Doc.Assessment_id.requires=IS_IN_DB(db,db.Assessment.id,'% > (InfoSys_id)s %(AssessmentDateStart)s %(AssessmentDateEnd)s') > > Perfect. So far, so good. But here's my problem - InfoSys_id is a > foreign key and thus a number. What I really want is the data that > number represents, which is InfoSys.ISName. How is it possible (or is > it possible) to represent InfoSys_id as InfoSys.ISName, along with the > two dates, in a drop down list? I wrote a join query that returns the > required information, but can't figure out syntactically how to stuff > it into the validator (assuming it's even possible)... > > db(db.Assessment.InfoSys_id==db.InfoSys.id).select(db.InfoSys.ISName) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---

