Highlighted

## Round Up Measurement Calculation

Community Beginner ,
Nov 10, 2020

Copied

Hi,

I'd like to have the attached PDF calculate the required materials needed based on the square footage of a space.

In the example provided,

Area Totals (ft) shown are 11ft length x 12ft width.

The Total Square Feet (length x width) calculation is 125.33.

Total Square Feet's calculation is using 10.666667 x 11.75 = 125.33.

What script can I use to ensure Total Square Feet is calculated using round numbers from Area Totals (ft),  which are Length 11 ft and Width 12 ft in my example?

In the "TotalSquareFeet" field use a custom calcuation script like this:

``event.value = Math.round(Math.ceil(this.getField("AreaTotalsftlength1").value) * Math.ceil(this.getField("AreaTotalsftwidth").value) );``

If you do it like this it will total in a consistent manner as shown by any square footage  online calculator:

You should get this result in your PDF:

TOPICS
How to

Views

51

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## Round Up Measurement Calculation

Community Beginner ,
Nov 10, 2020

Copied

Hi,

I'd like to have the attached PDF calculate the required materials needed based on the square footage of a space.

In the example provided,

Area Totals (ft) shown are 11ft length x 12ft width.

The Total Square Feet (length x width) calculation is 125.33.

Total Square Feet's calculation is using 10.666667 x 11.75 = 125.33.

What script can I use to ensure Total Square Feet is calculated using round numbers from Area Totals (ft),  which are Length 11 ft and Width 12 ft in my example?

In the "TotalSquareFeet" field use a custom calcuation script like this:

``event.value = Math.round(Math.ceil(this.getField("AreaTotalsftlength1").value) * Math.ceil(this.getField("AreaTotalsftwidth").value) );``

If you do it like this it will total in a consistent manner as shown by any square footage  online calculator:

You should get this result in your PDF:

TOPICS
How to

Views

52

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 10, 2020 0
8 Replies 8
Most Valuable Participant ,
Nov 10, 2020

Copied

Use this code:

var v1 = Number(this.getField("AreaTotalsftlength1").valueAsString);
var v2 = Number(this.getField("AreaTotalsftwidth").valueAsString);
event.value = (v1*v2).toFixed(2);

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 10, 2020 0
Nov 10, 2020

Copied

In the "TotalSquareFeet" field use a custom calcuation script like this:

``event.value = Math.round(Math.ceil(this.getField("AreaTotalsftlength1").value) * Math.ceil(this.getField("AreaTotalsftwidth").value) );``

If you do it like this it will total in a consistent manner as shown by any square footage  online calculator:

You should get this result in your PDF:

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 10, 2020 0
Community Beginner ,
Nov 10, 2020

Copied

Thank you very much for this script. It worked perfectly!

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 10, 2020 1
Community Beginner ,
Nov 11, 2020

Copied

ls_rbls

How can I get the Area Totals (ft) to always round up? Is there a script that will make this work?

In the attached image, the Area Totals (ft/in) are 15 ft 10 inches for Length and 12 ft 5 inches for Width.

The Area Totals (ft) are shown as 16 ft Length and 12 ft Width (however if you click it shows 15.833 Length and 12.41667 Width).

I am trying to get the Area Totals (ft) shown to display 16 ft Length and 13 ft Width so that the calculation shown for Total Square Feet will appear accurate. Total Square Feet is 208 ft. which is (16x13).

Any help would be appreciated.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2020 0
Contributor ,
Nov 11, 2020

Copied

Why would you round up so much? Shouldn't you be accurate?

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2020 0
Nov 11, 2020

Copied

For those two fields, instead of using "Number" to format them, add the following custom format script in both of them:

``event.value = Math.ceil(event.target.value);``

Here's a copy of your original with the scripts added to it: Project Estimator

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2020 0
Nov 11, 2020

Copied

I agree with Asim, but I think in this case, when you're converting "feet to inches to inches" in the formula that is currently used the accurate result is : 15.833333333333334.

Since it is a project estimator is OK to make this rounding up. If it was a construction project where you are actually buying panels of wood to build a wall in a house, then yes; it is extremely important to punch in the exact measurements, so that you don't get overcharged, and so thaty you also don't run short on materials if your contractor cuts everything with the incorrect measurements.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 11, 2020 0
LATEST
Community Beginner ,
Nov 12, 2020

Copied

Thank you!!

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 12, 2020 0
Resources