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

Fillable form with math formula not working

Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Hello all,

 

I am trying to add a math formula to a Fillable pdf and I am running into some issues. I have taken a formula from excel and need it to work inside of this pdf with no luck. I've got this portion of the formula to work: G29*((G30-G28)/(G30-G31)) I need this equation taken to the power of 0.54. Is there anyone who can help me with this?

TOPICS
PDF , PDF forms

Views

1.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 2 Correct answers

Community Expert , Nov 02, 2023 Nov 02, 2023

OK, then you must switch to using a script, such as this one (note you must also take into account the situation where G30 equals G31, to avoid division by zero):

 

 

var G28 = Number(this.getField("G28").valueAsString);
var G29 = Number(this.getField("G29").valueAsString);
var G30 = Number(this.getField("G30").valueAsString);
var G31 = Number(this.getField("G31").valueAsString);

var v1 = (G30-G31);
if (v1==0) event.value = "";
else {
	var v2 = (G30-G28);
	var v3 = G29*(v2/v1);
	event.value = M
...

Votes

Translate

Translate
Community Expert , Nov 02, 2023 Nov 02, 2023

Ah, OK, that makes more sense... Then change these two lines:

var v3 = G29*(v2/v1);
event.value = Math.pow(v3, 0.54);

To:

var v3 = (v2/v1);
event.value = G29*Math.pow(v3, 0.54);

Votes

Translate

Translate
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Math.pow(base, exponent)

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Sorry I'm very "dumb" when it comes to this, I would input what you typed where? 

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Are you using a script to perform the calculation? If so, post your code.

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

What I posted above is exactly what I put inside the simplified field notation. Nothing is in calculation script

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

I attached a picture

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

OK, then you must switch to using a script, such as this one (note you must also take into account the situation where G30 equals G31, to avoid division by zero):

 

 

var G28 = Number(this.getField("G28").valueAsString);
var G29 = Number(this.getField("G29").valueAsString);
var G30 = Number(this.getField("G30").valueAsString);
var G31 = Number(this.getField("G31").valueAsString);

var v1 = (G30-G31);
if (v1==0) event.value = "";
else {
	var v2 = (G30-G28);
	var v3 = G29*(v2/v1);
	event.value = Math.pow(v3, 0.54);
}

 

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

(I edited the code above to make sure the values are converted to numbers)

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Awesome!! I just need to copy and paste this into my pdf and I'm good to 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
Community Expert ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Yes, under the "Custom calculation script" option.

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Copy and pasting that does not give me the correct results. Here is the formula i am trying to replicate from the excel spreadsheet. =+G29*((G30-G28)/(G30-G31))^0.54 Maybe looking at the original one will help guide me in the right direction?

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Can you share the PDF file?

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

 

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

I shared the link. Its doing some math but not giving me the right results. 

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

With the numbers in the spreadsheat now my bottom box in green should show 2,499. 

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

That's incorrect.

(1048*((70-20)/(70-60)))^0.54 = 101.962128972 

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

The 1048 should not be included in the power of .54 we need power of 54 on all the math and then it be multiplied by the 1048

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Ah, OK, that makes more sense... Then change these two lines:

var v3 = G29*(v2/v1);
event.value = Math.pow(v3, 0.54);

To:

var v3 = (v2/v1);
event.value = G29*Math.pow(v3, 0.54);

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Hmm I don't see what seems to be the issue I'm not getting the numbers I need. 

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 ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

Works fine for me. See attached.

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
Explorer ,
Nov 02, 2023 Nov 02, 2023

Copy link to clipboard

Copied

LATEST

I see what I did, I got it to work on my end. Appreciate you taking your time to help and explain!!!!

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