I have a relatedjoin as follows:

class RailCategory(SQLObject):
    class sqlmeta:
        style = Style(longID=True)
        idName = 'railCategoryId'
   
    name = UnicodeCol(length=50)
    description = UnicodeCol()
    railCars = RelatedJoin("RailCar", intermediateTable="railCategoryCar",
                         joinColumn="railCategoryId", 
otherColumn="railCarId")

class RailCar(SQLObject):
    class sqlmeta:
        style = Style(longID=True)
        idName = 'railCarId'
   
    carInitials = UnicodeCol(length=10)
    carNumber = IntCol()
    active = BoolCol(default=True)
    createdOn = DateCol(default=datetime.now())
    railCategories = RelatedJoin("RailCategory", 
intermediateTable="railCategoryCar",
                         joinColumn="railCarId", 
otherColumn="railCategoryId")

Now I want to get a list of rail cars in a category.  However, I want 
the rail cars sorted by the name of the rail car.

Here is where I'm at:

    #  Get the data and add it to the report
    rcats = RailCategory.select(orderBy='name')
    for rcat in rcats:
        printName = rcat.name
        for rc in rcat.railCars:
            print rc.name

My problem is that I want to railCar name (or carInitials, carNumber) to 
be in alpha order.  Is there a way to specify the sort order when 
getting the data from a related join?  I know I can easily get the data 
doing .select()s for both objects, but thought it would be nice if I 
could get the relatedjoin data and specify the sort order somehow.

    -Jim

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to