• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Acrobat Pro DC Textfelder addieren die ein bestimmten Text beinhalten

Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Aug 07, 2019 Aug 07, 2019

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; 

Votes

Translate

Translate
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

Info: Acrobat uses Javascript, not Java.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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++;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Thank you very much, great that it was so fast and accurate.

Could scream with joy

My last question, where is it inserted?

Text field properties in calculation or validation?

...or better, where and how exactly is this inserted?

Thx

Niko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

At the calculation of the field where you want display the result.

At the end add the line:

event.value = count;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Thanks again for your help.

It's really a big help for me.

I'll use it tomorrow, when I'm back in the office.

Since I found this forum, I start to see some light in my Acrobat tunnel.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

ll be at the office as soon as I can to try it out...I was determined to finish it today.

var count = 0;

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

event.value = count;

It works, but I don't know how to add all Text boxes (fields) i want.

The script is only for one text box, but wants to add several text boxes together if it is content.

How do I add several text boxes together if they are not empty?

sorry if I get on my nerves and thanks again in advance

Niko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

If I may add an example.

I want to count Text Box 10 to 19 if Text Box has content, if no content doesn't count then.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

You can use something like this:

var count = 0;

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

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

}

event.value = count;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

I'm doing something wrong.

I have text fields named "10" to "19", I copied the script, but it doesn't work.

    var count = 0; 

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

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

    } 

    event.value = count; 

where do I make the mistake?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Change:

getField("10"+i)

To:

getField(i)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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; 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

No, it just counts how many fields have a value that isn't empty.

Do you want to add their actual values, ie sum them up?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Probably or rather, I'm making a mistake somewhere.

however, it's depressing, will continue tomorrow...thank you for your time and effort.

Any additional help is still welcome.

Thx

Niko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Check the console for errors.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

This is not the script from my last post...Take the code from your reply #14.

If it's not working there's probably an error. You should check the JS Console.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 07, 2019 Aug 07, 2019

Copy link to clipboard

Copied

Thx again all for your Help...now i solve the problem

Must've slept in to get the hang of it.

All well, thank you it was really a big help.

Wishes all a good and happy day, may everything work out

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 08, 2019 Aug 08, 2019

Copy link to clipboard

Copied

One last

Try to count the sum of the fields with certain text "E" together, without success.

-------------------------------------

var count = 0;

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

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

    }

    event.value = count; 

-------------------------------------------

What am I doing wrong in the script?

Thx

Niko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2019 Aug 08, 2019

Copy link to clipboard

Copied

You're using the wrong opearator. "!=" means NOT EQUALS. You should be using "==", which is the EQUALS comparison operator in JS.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 08, 2019 Aug 08, 2019

Copy link to clipboard

Copied

LATEST

You're not human... you're an angel

Thank you, now it has sparked

Have a nice day

Niko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines