Skip to main content
Known Participant
April 5, 2022
Question

Hi - Help needed please?

  • April 5, 2022
  • 2 replies
  • 1494 views

As a complete javascript novice I've been trying to duplicate the formulae in an operating Excel file, in an Acrobat 'form'. Below is an example of the typical Excel formula (of which there are x40), with reference to calculations performed on various cell data :

=D14-(D22*1000*0.02)/($T$20*35.6)-$M$5

I have attempted to use Acrobat 'custom calculation script' to perform the same process and arrived at this:

event.value = (this.getField("22_AWG01").value)-(0.326*1000*0.02)/(this.getField("Total_current").value*35.6)-(this.getField("Metres").value)

In many cases this does return the answer/s I was expecting - but not in every case. No doubt my method or syntax is probably inappropriate

I do have some extra functions/conditions to apply if possible, should I manage to get this fixed

MTIA
Steve


This topic has been closed for replies.

2 replies

Legend
April 5, 2022

I think you need to break it down and look at the exact detail. The formula looks plausible, but of course we don't know what's in your fields or what you see. Take one case where it doesn't do what you expect.

-Tell us the value Excel gives and the value found in D14, D22, T20 and M5.

-Tell us the value Acrobat gives.

-And tell us the value of 22_AWG01, Total_current and Metres

(As well, of course, as telling us why you've replaced the reference to D22 by the constant 0.326)

Known Participant
April 5, 2022

Test Screen Name, thanks for replying.
I'll do as you ask.

The Acrobat form is to calculate voltage drop over a 'custom' user entered 'wire length (max 2m)' & user entered 'wattage' figure.

A figure is calculated for each of the different wire gauge (AWG) sizes: 22 (0.326mmsq), 20 (0.5mmsq), 18 (0.75mmsq), 17 (1.0mmsq), 15 (1.5mmsq), 13 (2.5mmsq), 11 (4mmsq) and 9 (6.6mmsq)

As you indicate, it's my data entry into the javascript that's at fault

MTIA
Steve

Bernd Alheit
Community Expert
Community Expert
April 5, 2022

(0.326*1000*0.02)

Why does you use 0.326 here?

Known Participant
April 5, 2022

Hi Bernd - thanks for looking.

Sorry,  I confused the issue.
In the Excel file there are some referenced cells "D12, D22, D32, D42, D52" - that all have a set value 0.326.
I thought that it would be easier for me to 'read what was going on' if I substituted the Cell ref for its set value.

 

the sum I get from the above calc has to be converted from metres to feet

event.value = (this.getField("22_AWG01").value)/0.3048

 

Is my javascript fit for purpose?

Steve