Skip to main content
Nikolaos.
Inspiring
August 7, 2019
Answered

Acrobat Pro DC Textfelder addieren die ein bestimmten Text beinhalten

  • August 7, 2019
  • 3 replies
  • 3020 views

Hallo an alle,

brauche ein "bisschen" Hilfe

Wie kann ich mit Acrobat Pro DC (oder alternative Adobe LiveCycle Designer ES4) Textfelder addieren die ein bestimmten Textinhalt haben?

Bei einer anderen Textfeld reihe möchte ich Textfelder addieren die ein wert oder Text haben, wenn leer dann nicht zählen.

Ich weiß das dies mit Java möglich ist, als Laie weiß ich nur nicht wie

Danke für jede Hilfe im Voraus

Niko

This topic has been closed for replies.
Correct answer Nikolaos.

Change:

getField("10"+i)

To:

getField(i)


It does not add up the fields with content text

  var count = 0; 

    for (var i=10; i<=19; i++) { 

        if (this.getField(i).valueAsString != "") count++; 

    } 

    event.value = count; 

3 replies

Nikolaos.
Nikolaos.Author
Inspiring
August 7, 2019

Want you build the sum of fields or count the filled fields?

Both solutions would be great

Info: Acrobat uses Javascript, not Java.

You're right, sorry meant of course with javascript...as I said I'm still a beginner

Thx

Niko

Nikolaos.
Nikolaos.Author
Inspiring
August 7, 2019

Hi Bernd Alheit,

I want to use Acrobat Pro DC to add text fields that have a specific text content (what ever can be this text).

With another text field row I want to add text fields that have a value or text, if empty then don't count.

Thx

Niko

Bernd Alheit
Community Expert
Community Expert
August 7, 2019

You can use something like this:

var count = 0;

// for fields with specific text:

if (this.getField(" field name ").valueAsString == " specific text ") count++;

// for non-empty fields:

if (this.getField(" field name ").valueAsString != "") count++;

Nikolaos.
Nikolaos.Author
Inspiring
August 7, 2019

i want to count all fields from 10 to 19 that have a value/text, the empty fields do not count.

The script in my last post will do that.

The second script should count fields from 20 to 29 that have a certain text.

Alongside the 10-19 fields, or separately?

sorry if i don't express myself correctly, but my english is not the best

Your English is fine.


The script in my last post will do that.

i use this script and not works

  1. var count = 0
  2. for (var i=10; i<=19; i++) { 
  3.     if (this.getField("10"+i).valueAsString != "") count++; 
  4. event.value = count; 

Alongside the 10-19 fields, or separately?

separately

Bernd Alheit
Community Expert
Community Expert
August 7, 2019

Want you build the sum of fields or count the filled fields?

Info: Acrobat uses Javascript, not Java.