Thank you all Monks for your responses! I think your discussion reflect that there is a compromise to be taken between placing too much logic (which seems a business tier concern) into the template, and on the other hand, building an extra elaborate API which caters only to some special use case. I was hoping that there would be some TT plugin to do this particular job, as it would keep the complexity hidden, my API simple, and perhaps be useful to many a user. Do you think it is an idea to push forward?
Thank you again!