Dear all,
I have 3 fields in a line of a table. The third of them is the result of the multiplication of the first two.
Then there is a subtotal field which summarizes all the multiplications. But this isn't working fine.
Though when I show a Messagebox with the value of the subtotal field it seems fine, it doesn't show it fine in the proper field.
I write the code:
Multiplication:
form1.Pedido[0].Detalle.Posicion.NETWR::calculate - (JavaScript, client)
this.resolveNode("NETWR").rawValue
= this.resolveNode("MENGE").rawValue * this.resolveNode("NETPR").rawValue;Subtotal calculation:
form1.Pedido[0].Header.SUB_TOTAL::calculate - (JavaScript, client)
var numpos = xfa.resolveNodes("form1.Pedido[*].Detalle.Posicion[*].NETWR");
var vtotal = 0;
for (var i = 0; i < numpos.length; i++)
{
vtotal = vtotal +numpos.item(i).rawValue;
}
this.resolveNode("SUB_TOTAL").rawValue = vtotal;
xfa.host.messageBox("SUBTOTAL: " + SUB_TOTAL.rawValue + " " + vtotal);
What am I doing wrong?
Thanks a lot to everyone,
Eloi
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Eloi,
This can be done using formcalc.Have a look at the below document..
https://workspaces.acrobat.com/?d=oqBIplQg-IP-8255jt5Beg
Hope this would help you ...
Thanks
Vjay
Views
Replies
Total Likes
I think the wildcard * only works in formcalc not javascript.
Hi whyisthisme,
Thanks for replying.
I've found that the problem is showing a Messagebox. The Messagebox values are ok but the displayed data in the field not.
Do you (or anyone) knows why this happens?
Thanks a lot!,
Eloi
Views
Replies
Total Likes
Hi Eloi,
This can be done using formcalc.Have a look at the below document..
https://workspaces.acrobat.com/?d=oqBIplQg-IP-8255jt5Beg
Hope this would help you ...
Thanks
Vjay
Views
Replies
Total Likes
Thanks again Vijay!
Though I'm trying to learn it in Javascript.
When I remove the Messagebox display it works fine. I don't understand why.
Thanks again!,
Eloi
Views
Replies
Total Likes
Could you share that file with me so that i can have a look at it ...
Thanks
Vjay
The wildcards work with resolveNodes.
Good explanation here:
http://blogs.adobe.com/formfeed/2011/06/resolvenode-vs-resolvenodes.html
I think the problem might be the above - I don't think you can resolve two nodes like that.
You want to resolve the node that is doing the repeating, whether that be Pedido or Posicion.
Hi Jono,
thanks for answering.
I have this code (resolving two or more nodes) in many other places and works fine.
The problem is when I use the 'xfa.host.messageBox()' instruction.
Thanks again,
Eloi
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies