Skip to main content
Participating Frequently
November 30, 2022
Answered

I have 2 rather complicated forms and I am looking for some help. TIA!

  • November 30, 2022
  • 2 replies
  • 2492 views

I have 2 rather complicated forms and I am looking for some help. I am not sure if Javascript should be used here. I maybe over thinking this!

CALCULATION 1

#___________ of trucks
x $ ___________ $8,000 (per CPC)
x $ ___________ $10,000 (per truck in other repairs)
+ ___________ labor & taxes

___________________________________________
= $ ___________ total repairs

____________________________________________________________________

CALCULATION 2
#___________ of trucks
x $ ___________ $ rate per day
___________________________
x___________ 90 days to get CPC module
___________________________
x___________ 10 days for repairs
___________________________
+ #___________ hours spent focusing on the incident
x $___________ hourly rate
___________________________
= $___________ total lost revenue

This topic has been closed for replies.
Correct answer JR Boulay

There is no need for JavaScript.

See attachement.

2 replies

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
December 1, 2022

There is no need for JavaScript.

See attachement.

Acrobate du PDF, InDesigner et Photoshopographe
Participating Frequently
December 1, 2022

Thank you for your support. I used some of your functions along with Nesa's it in combination I thin works very well. I have attached the file. It has been a few years since I have had to apply any calculations to a PDF. 🙂

Nesa Nurani
Community Expert
Community Expert
December 1, 2022

If it's a simple calculation, you can use simplified field notation. Can you provide field names included in calculation with an example how it should look?

Participating Frequently
December 1, 2022

Hi Nesa, Here are the field names in ( BOLD). I also attached a picture of what it will look like. Thank you for your help. 🙂 Sheryl

CALCULATION 1

#___________ of trucks (Tab1-1)
x $ ___________ $8,000 (per CPC) (Tab1-2)
x $ ___________ $10,000 (per truck in other repairs) (Tab1-3)
+ ___________ labor & taxes (Tab1-4)

___________________________________________
= $ ___________ total repairs (Tab1-total)

____________________________________________________________________

CALCULATION 2
#___________ of trucks (Tab2-1)
x $ ___________ $ rate per day (Tab2-2)
___________________________
x___________ 90 days to get CPC module (Tab2-3)
___________________________
x___________ 10 days for repairs (Tab2-4)
___________________________
+ #___________ hours spent focusing on the incident (Tab2-5)
x $___________ hourly rate (Tab2-6)
___________________________
= $___________ total lost revenue (Tab2-total)

Nesa Nurani
Community Expert
Community Expert
December 1, 2022

 

As custom calculation script of "Tab1-total" field use this:

var t1 = Number(this.getField("Tab1-1").valueAsString);
var t2 = Number(this.getField("Tab1-2").valueAsString);
var t3 = Number(this.getField("Tab1-3").valueAsString);
var t4 = Number(this.getField("Tab1-4").valueAsString);
event.value = (t1*t2)+(t1*t3)+t4;

 

 

As custom calculation script of "Tab2-total" use this:
var c1 = Number(this.getField("Tab2-1").valueAsString);
var c2 = Number(this.getField("Tab2-2").valueAsString);
var c3 = Number(this.getField("Tab2-3").valueAsString);
var c4 = Number(this.getField("Tab2-4").valueAsString);
var c5 = Number(this.getField("Tab2-5").valueAsString);
var c6 = Number(this.getField("Tab2-6").valueAsString);
event.value = (c2*(c3+c4)*c1)+(c6*c5);