cancel
Showing results for 
Search instead for 
Did you mean: 

how to calculate sum of the fields in adobeforms

surendra_battula
Participant
0 Kudos

Hello Experts

can  i know how to calculate sum of fields in the adobe form.  I have few fields to be summed in total field.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

pavan_prabhu
Active Participant
0 Kudos

Hello Surendra,

     Suppose you are having 4 fields and the 4th field is the TOTAL field.

     Write the below Javascript on the Initialize event of TOTAL field as shown below.

Remember that if you use just "+" sign without Number() or ParseInt() function it acts like String Concatenation.

this.rawvalue = Number( this.parent.field1.rawvalue ) +

                      Number( this.parent.field2.rawvalue ) +

                      Number( this.parent.field3.rawvalue ) ;

You can also write is as shown below.

this.rawvalue = parseInt( this.parent.field1.rawvalue ) +

                         parseInt( this.parent.field2.rawvalue ) +

                         parseInt( this.parent.field3.rawvalue ) ;




surendra_battula
Participant
0 Kudos

THANKS IT IS WORKING FINE.

Answers (1)

Answers (1)

former_member183073
Active Participant
0 Kudos

you can use java script to calculate the sum.

You can use script like this in initialization event of the field where you want to show the total.

this.rawValue = root.node.field1.rawValue+root.node.field2.rawValue

surendra_battula
Participant
0 Kudos

thnks but it is append the values next to the first field like field1,field2 instead of calculating.

pavan_prabhu
Active Participant
0 Kudos

Hello Surendra,

     Remember that if you just use "+" sign, it acts like String Concatenation. To add the values of fields, you have to use either of Number() or ParseInt() function. Then it calculates with respect to Integer.