Expand my Community achievements bar.

SOLVED

field's visible value

Avatar

Former Community Member

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

1 Accepted Solution

Avatar

Correct answer by
Level 5

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

View solution in original post

8 Replies

Avatar

Level 7

I think the wildcard * only works in formcalc not javascript.

Avatar

Former Community Member

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

Avatar

Correct answer by
Level 5

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

Avatar

Former Community Member

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

Avatar

Level 5

Could you share that file with me so that i can have a look at it ...

muchukotavijay@gmail.com

Thanks

Vjay

Avatar

Level 10

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.

Avatar

Former Community Member

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