Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Request for Assistance Script complex calculation of VAT.

Avatar

Former Community Member

Hello everyone.
Sorry for my English, I use Google to translate from French into English.

After my first form with your help, I realized the power of PDF files.

I come to you today for the design of a complex script a bit special.


In the table below, I wish that when we return 0, 1 or 2 in the box TVA
TOTAL HT that starts automatically in the MONTANT HT box of the table below were the results for each line adds added as in the example below. My Form


23-03-2011 11-54-39.png
ValdoFR

Bonjour à tous.

Désolé pour mon anglais, je me sers de Google pour traduire du français vers l’anglais.

Après avoir fait mon premier formulaire avec votre aide, je me suis rendu compte de la puissance des fichiers PDF.

Je viens vers vous aujourd’hui pour la conception d’un script complexe un peu spéciale.

Dans le tableau ci-dessous, je voudrais que lorsque l’on rentre 0, 1 ou 2 dans la case TVA,

Que le montant TOTAL HT se mette automatiquement dans la case MONTANT HT du tableau du dessous été que les résultats s’additionne pour chaque lignes ajoutées comme dans l’exemple ci-dessous. Mon Formulaire

ValdoFR

4 Replies

Avatar

Level 10

Hi ValdoFR,

It can be done and with a number of approaches.

Basically you will need to set up a loop, to work through the rows and sum the relevant total.

Here is an example: https://acrobat.com/#d=byrO8kt0Sm6t*wyOS7sxGw. It is not exactly what you are after, but it shows the principle.

For example this SHOULD work in the calculate event of the first total MONTAN HT field:

var nRows = Table1._Row1.count;

this.rawValue = 0; // reset MONTAN HT total

for (var i=0; i<nRow; i++)

{

     var targetRow = xfa.resolveNode("Table1.Row1[" + i + "]");

     if (targetRow.TVA.rawValue == 0)

     {

          this.rawValue = this.rawValue + targetRow.HT.rawValue;

     }

}

You will need to insert your object references.

Good luck,

Niall

Avatar

Former Community Member

Niall

hello

, glad to see you again.
I think I explained myself badly.
I made ​​a drawing below, or you can download my form.
I'm sure you understand dessuite.
That said, I do not know if it's feasible.

23-03-2011 19-22-03.png

ValdoFR

Avatar

Former Community Member

Thank you

Niall,
I'll try to adapt it to my table.

ValdoFR