The 2nd example, function, gets an error:

   - In the controller the function error is: <type 'exceptions.NameError'> 
   name 'rtid_represent' is not defined
   - If I put the function in the model, error is: <type 
   'exceptions.SyntaxError'> 'return' outside function (db.py, line 1013)
   

The first example works great, thanks.

Alex

On Monday, June 10, 2013 12:19:08 AM UTC-7, Alex Glaros wrote:
>
> I'm trying to concatenate the results of  two represents clauses for the 
> same field: "relationshipTypeID"    The first "represents" clause returns 
> "subjectAreaCode" and the second  returns "relationshipTypeCode".  Without 
> all the queries, this could normally be accomplished by '%(field_1)s 
> %(field_2)s' format, but one of my represents uses a full query.
>
> I can't stack the "represents" clauses because the last one overwrites the 
> first one.  How can I get both fields to display whenever the 
> "relationshipTypeID" field is used? Here are the two "represents" clauses:
>
> db.RelationshipRoleType.relationshipTypeID.represent = lambda id, r: db((
> db.RelationshipType.id==id) & (db.RelationshipSubjectArea.id == db.
> RelationshipType.relationshipSubjectAreaID) & 
> (db.RelationshipSubjectArea.subjectAreaID 
> == db.SubjectArea.id)).select().first().SubjectArea.subjectAreaCode
>
> db.RelationshipRoleType.relationshipTypeID.represent = lambda id,row: db.
> RelationshipType(id).relationshipTypeCode
>
> Thanks,
>
> Alex Glaros
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to