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

Need help with simple(?) calculation please

Community Beginner ,
Jan 29, 2019 Jan 29, 2019

Hello

I have an interactive pdf form where my simple calculation doesnt get the correct answer - sometimes no answer at all?

A= number input by user

B= number input by user

V= A*B

so far so good, then:

C= number input by user

D= 0.8 1.2 3.5 (drop down list)

     0.8 generates export value 0.7

     1.2 generates export value 1.0

     3.5 generates export value 2.3

Q= product of C and respective exported value ------ this value is sometimes 0?

T=V/Q*60  -----this is the final value which I never seem to get right

TOPICS
PDF forms
552
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 29, 2019 Jan 29, 2019

Did you check the field calculation order?

View solution in original post

Translate
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 ,
Jan 29, 2019 Jan 29, 2019

If Q is zero then you can't calculate a value for T, as division by zero is not allowed.

You must therefore use a script for T's calculation event, checking first if Q is zero. If so, apply an empty value to it.

If not, proceed with the calculation.

Translate
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 Beginner ,
Jan 29, 2019 Jan 29, 2019

I understand that but Q should never be zero.  Q must equal product of C and respective exported value - but sometimes the product is not calculated.

Now when I filled it in again I got Q but not T...

Translate
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 Beginner ,
Jan 29, 2019 Jan 29, 2019

This is the calculation for T:

var volume = this.getField("V")

var flow = this.getField("Q")

if (flow.value==0) event.value = "";

else event.value = ( volume.value / flow.value ) * 60

Translate
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 ,
Jan 29, 2019 Jan 29, 2019

Did you check the field calculation order?

Translate
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 Beginner ,
Jan 29, 2019 Jan 29, 2019

Field order is: A, B, V, C, D, Q and T

Translate
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 Beginner ,
Jan 29, 2019 Jan 29, 2019
LATEST

Field calculation order helped - the solution was that simple!

Translate
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 Beginner ,
Jan 29, 2019 Jan 29, 2019

Now I got value for T ...Is this a bug?

Also,

If I keep D the same (in this case D=1.2 which generates 1.0) and only change C.

I get different values for T...

  • C=6-->Q=6-->T=51sec should be 60 sec....
  • C=7-->Q=7-->T=60sec (unlogical...)
  • C=8-->Q=8-->T=51sec (unlogical...)
  • C=9-->Q=9-->T=45sec (what I mean is that the time should decrease as C increases...)

then I try C= 6 again:

  • C=6-->Q=86->T=40sec (???? unlogical...) should be 60 sec....
Translate
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