sorry, but i really don’t get it
i’m trying to calculate the total amount of specific lines in the invoice report (“invoice.fdot”)
this is what i came up with so far:
<for each="line in invoice.lines">
<if test="line.account.code == '8402'">
total of loop => <sum_loop>
what is the correct line for xxxxx to have an expression like
It is not advised to make computation in the template. You should make the computation on the instance or in the report context.
Genshi syntax does not have assignation statement. At best you could use Python sum if you set it in the context like
sum(l.amount for l in invoice.lines if l.account.code == '8402')
Also you should probably avoid the hard-coding of code value and instead use a flag on the account (or type).
thank you for the quick reply - i will put this computation into the report context.