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

Help with a form calculation

New Here ,
Sep 16, 2022 Sep 16, 2022

Copy link to clipboard

Copied

Hi all. I was just wondering whether someone could assist with a form I have created in Adobe.  I have a form which has to two columns which store numbers used for a progressive calculation. Doing the simple addition calulation is fine, but I dont want the progressive total to show up in all the rows where there is no data.  In excel it would be a simple IF formula, where if there is no data, it doesnt calculate.  Here is snapshot below of what I mean.  As you can see, where there is only three truck loads, the entire colums is filled out, with row three repeated all the way to the bottom.  Is there something similar to an IF function in Adobe? I have also attached the form.  Would greatly appreciate your assistance on this.  Thank you

Craig26160076pl76_0-1663391408455.png

 

TOPICS
General troubleshooting , PDF forms

Views

731

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 ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

Place this code as a doc-level script and then call that function from the custom calculation event of each one of those fields:

 

function calcProgressiveTonnes() {
	var rowNumber = Number(event.target.name.replace("Progressive TonnesRow", ""));
	if (this.getField("Truck TonnesRow"+rowNumber).valueAsString=="") event.value = "";
	else {
		if (rowNumber==1) event.value = this.getField("Truck TonnesRow"+rowNumber).valueAsString;
		else event.value = Number(this.getField("Truck TonnesRow"+rowNumber).valueAsString)+Number(this.getField("Progressive TonnesRow"+(rowNumber-1)).valueAsString);
	}
}

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
New Here ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

Hi Mate,  thanks heaps for your reply and assistance.  As a 'very' basic user of Adobe products, I am still on my 'L' plates with Adobe Acrobat Pro. As for 'doc level scripts' and how to implement this javascript, I have no idea.  Is there any chance you would be able to implant that code into the file I originally attached.  Thank you.  Craig

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 ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Here you go...

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
New Here ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Thanks mate. I really appreciate it. The form works great on the computer, however I did try to use it on the IPAD and it didnt work.  Any ideas as to why the formula woudn't work on the IPAD Adobe App?

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 ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

LATEST

Acrobat Reader doesn't support all JavaScript features.

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