employee = db(db.Employee.eName == var).select().first()
The above will give you a Row
object containing the record for this employee (technically, it will be the first record that matches eName in case eName is not unique). In a view, you can then use employee.job
, employee.address
, etc.
This is all explained in the documentation. I suggest you read it and then post specific questions, preferably on the Google Group.
That's what I thought too. The docs says "sort the records according to multiple fields", so I think you're right. I submitted an issue. Thanks! orderby in the official docs
>I would say the most confusing thing about the database abstraction layer is the distinction between Set, Row, and Rows. I end up a lot of the time doing things to a Set that I should be doing to a Row or Rows object and vice versa. Python's dynamic typing makes this problem worse.
Perhaps this could be better explained, though this is the nature of object oriented programming and enables a lot of functionality. What alternative would you propose that would be easier to understand (without a significant sacrifice in functionality)?
>In the view you can mix javascript and python, and I think this can make the code into a mess if you are not careful.
Are you complaining about web framework template engines in general, or web2py in particular? This doesn't sound specific to web2py. Are you aware of a web framework that handles this better in your opinion?
> By source code documentation, I mean http://www.web2py.com/examples/static/epydoc/index.html
Yes, I agree, the source code could be better documented (it's good in some places, not so good in others).
let me say first that I come from a C/C++/Matlab background so pretty much everything is new for me.
I would say the most confusing thing about the database abstraction layer is the distinction between Set, Row, and Rows. I end up a lot of the time doing things to a Set that I should be doing to a Row or Rows object and vice versa. Python's dynamic typing makes this problem worse.
In the view you can mix javascript and python, and I think this can make the code into a mess if you are not careful. Especially for a beginner like myself, I'm not sure whether I should be using javascript or python to be performing a particular task. So I generally end up trying to combine the two to perform one operation , and it turns into a hideous spaghetti code that comprise of html, javascript, and python. I am now starting to understand javascript better so I'm using less and less python in the view.
Eventually in the view, I would just like to have a section of the code that loads all the necessary python variables from the controller into javascript variables so that I can minimize the mixing of python and javascript.
By source code documentation, I mean http://www.web2py.com/examples/static/epydoc/index.html