Skip to main content
Participating Frequently
August 2, 2016
Answered

custom formatting and calculations in form fields?

  • August 2, 2016
  • 1 reply
  • 2749 views

On my excel spreadsheet report I track  construction progress in linear ft from one station number to another.   Station numbers are expressed exactly like with decimal places except the decimal is replaced with  the plus sign '+'.  So if were to type inOn my excel spreadsheet report I track  construction progress in linear ft from one station number to another.   Station numbers are expressed exactly like with decimal places except the decimal is replaced with  the plus sign '+'.  So if were to type in 200 it becomes 2+00 (which means station # 200... i.e. 200ft from the starting point of 0+00)  It's really easy set this up in excel through custom formatting and doesn't effect the ability to subtract one station # from another to automatically calculate daily footages.   How would I go about learning how to set this up in acrobat form fields?  Thanks

This topic has been closed for replies.
Correct answer George_Johnson

Yeah, I've explained poorly, let me try again.    Construction starts at 0+00.  Which is zero footage obviously.   Each linear foot away from the starting, Station #'s are expressed from right to left.   Station#  0+01 is one foot from the start.  Station 0+50 is 50ft and Station#  1+00 is 100ft  from the starting point of 0+00. 

If I wanted to express the Station# the distance of 1.5ft from the start I would write it as 0+01.5   But  It's not practical for most of my documentation purposes to worry about  inches so I don't need the ability to express stations beyond making sure that there is a '+' symbol before the last two digits, no matter how long the string is.    For instance,   I need to be able to just type in 708925 and upon enter have display 7089+25.   More than that, lets assume 7089+25 is my starting station for the day and 7099+75 is my finishing point. 

I need a separate cell that will calculate and return the difference of 1,050 expressed normally with a coma.  it's very easy in excel.  I'm just wondering if a pdf form can have that same level of functionality and how to achieve it.  

but for your examples. 

1.5 =  0+02 (because I would just round up)

15 =  0+15

1000.6 =   10+01 (because again I would just round up to an even 1,001 ft. 

34567 = 345+67  

hope that clarified better. 


OK, you can use the following custom Format script for a text field:

// Custom Format script for text field

if (event.value) {

    event.value = util.printf("%.2f", event.value / 100).replace(".", "+");

}

This can be expressed in plain English with: If the field is not blank, divide the value by one-hundred, round the result to the nearest tenth, and replace the decimal point with a plus sign.

A format script is used to change what's displayed in the field while leaving the underlying field value unchanged, so the field value can be used in normal numeric calculations.

1 reply

Inspiring
August 2, 2016

Do you mean that an entry of 200 becomes 200+00?

If not, that's not what you described when saying "Station numbers are expressed exactly like with decimal places except the decimal is replaced with  the plus sign '+'."

Participating Frequently
August 2, 2016

No, I'm sorry, I described that wrong.   200 would be expressed as 2+00.   

Inspiring
August 2, 2016

I think it would be good if you gave more examples. What would the following numbers get displayed as:

1.5

15

1000.6

34567