yeah, I see what you mean... Should have waited a bit. So much for clever 4am analogies... ;) Wasn't really for animals ;)
I think what you have works for this. I wanted to be able to throw a list at '.last()' because the same set of 50 to 60 rows get generated every time a build is run. sometimes all fields in a given row change, sometimes none, and sometimes some change, with an average of 50 to 60 new rows get inserted at each build. SO this was just to make it easy to do : "get the the last values we have for items in this list". I can have a func that will do it, I just didn't want to re-invent if there was something like it already :). I will wrap what you posted in a function. That should do it:) rows = db(db.animal.paws==4).select() last_rows = [rows.find(lambda r: r.species=x).last() for x in myList] Thanks for the help/reply, Mart :) On Apr 15, 5:53 am, DenesL <[email protected]> wrote: > Hi Mart, > > following your example I am not sure what you want but try something > like > > rows = db(db.animal.paws==4).select() > last_rows = [rows.find(lambda r: r.species=x).last() for x in myList] > > On Apr 15, 4:51 am, mart <[email protected]> wrote: > > > > > > > > > Hi, > > > Is there a way to pass a list to rows = db(...).select().last() ? > > > would be a time saver to be able to do something like: > > > myList = ['dog, > > 'cat, > > 'kangooroo', > > 'fish'] > > > 4_legged_pets = [] > > > rows = db((db.animal.id>0)&(db.animal.paws==4)).select() > > last_rows = rows.last(myList) > > for pet in last_rows: > > if pet['paws'] == 4: 4_legged_pets.append(pet) > > elif pet['paws'] == 2: ...blablabla > > > this way we get the last_row for all animals in one call (saves tones > > of typing time) > > > is there a built-in way for doing this or is it best to make a > > function somewhere? Of course checking if db.animal.isempty(): before > > would also be a time saver :) > > > thanks, > > Mart :)

