0

Client side math operation in listbox

asked 2014-05-23 06:32:29 +0800

demizon gravatar image demizon
169 1 6

Hi, I have listbox with 3 columns A,B and sum. I am getting a and values from database. What i need is to sum them up in each row. I tried to do it like this but it doesnt work...:

<listitem>
<listcell label="@load(each.a)"/>
<listcell label="@load(each.b)"/>
<listcell>
<zscript>
 int sum = ${each.nrOfPieces}+$(each.vyrobok.pocetKz);
</zscript>
<label value="${sum}" />
</listcell>
</listitem>

but it doesnt work... thx for any advices

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2014-05-24 21:19:48 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

updated 2014-05-24 21:20:23 +0800

EL expressions can be very powerful. Have a look here.

The following snippet should do the trick:

<listitem>
   <listcell label="@load(bean.amount)" />
   <listcell label="@load(bean.tax)" />
   <listcell label="@load(bean.amount + bean.tax)" />
</listitem>

Hope that helps, Costas

link publish delete flag offensive edit
1

answered 2014-05-24 01:59:58 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

i don't learned still that, but if it help, you can put a calculated field on java (there are calculated fields for JPA) i did an example here: Example-for-calculate-field

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-05-23 06:32:29 +0800

Seen: 15 times

Last updated: May 24 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More