*Hi Leandro, can you use javascript? (just add the fields onblur, then set form value to the total?) * On Tue, Aug 23, 2011 at 9:27 AM, Leandro Severino < lean...@professionalit.com.br> wrote:
> Friends, > > I'm developing a report where the output is a html table. > > My query return records with some values and when I show the output > I need execute some operations as SUM, TOTAL and Group Total. > > My model: > > id > name > value_question_1 > value_question_2 > > Sample data: > ID NAME Q1 Q2 > 01 - My Company ABC - 2 - 3 > 02 - My Company DEF - 1 - 1 > 03 - My Company ABC - 1 - 1 > 04 - My Company XYZ - 4 - 5 > 05 - My Company ABC - 4 - 1 > > Well, in my query I make a order by "name" then I have a sorted > results. > > Now, I need a output as: > > My Company ABC TOTAL: > Question 01: 2 | 1 | 4 7 (this column is the sum of > values of the question 1) > Question 02: 3 | 1 | 1 5 > > My Company DEF > Question 01: 1 1 > Question 02: 1 1 > > My main doubts is: how to do a loop for show the outputs while the > name is equals ? I think in create a variable as previous_name and > make a comparation, for example: > // Loop in the records for show the output in html table > $if previous_name != record['name']: > // re-write the table headers or re-write the table. > $else: > // show the output > // make another sum operation > > Then when I declare the variable in template as: > $var previous_name > and the output try access the if of comparation a error is > showed: > > SyntaxError: Invalid var statement > > Then, how to declare a empty variable in template ? and how to > make a SUM operation in this variable ? > > best regards, > Leandro. > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to webpy@googlegroups.com. > To unsubscribe from this group, send email to > webpy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.