Skip to main content
jasons35699793
Known Participant
April 1, 2019
Answered

Placing decimals and whole numbers in separate boxes

  • April 1, 2019
  • 1 reply
  • 588 views

I have a form that separates whole numbers and decimals. What I need to do it take the sum of two boxes 1stFloor and 1stFloordec subtract 0.4 from the total and place the whole number in Garage and the remaining decimal in Garagedec. Summing the two and subtracting works fine its just getting it to place the whole number in Garage and the remaining decimal in Garagedec I'm having trouble with.

    This topic has been closed for replies.
    Correct answer try67

    You posted in the Reader forum. If you're setting up form fields and calculations you probably have Acrobat, though.

    You will have to do it using a script. After getting the result you would need to take it and then split it into the integer part and the decimal part. The code to do it would be something like this:

    var result = 10.14;

    this.getField("Integer").value = result.toString().split(".")[0];

    this.getField("Decimal").value = result.toString().split(".")[1];

    1 reply

    try67
    Community Expert
    try67Community ExpertCorrect answer
    Community Expert
    April 2, 2019

    You posted in the Reader forum. If you're setting up form fields and calculations you probably have Acrobat, though.

    You will have to do it using a script. After getting the result you would need to take it and then split it into the integer part and the decimal part. The code to do it would be something like this:

    var result = 10.14;

    this.getField("Integer").value = result.toString().split(".")[0];

    this.getField("Decimal").value = result.toString().split(".")[1];