My issue in a nut shell. I have built a PDF Worksheet used to calculate materials to build a chain link fence (line and terminal posts, fence fabric, concrete, gates, labor, etc,. It is made up of many Drop Down fields and Text fields which calculates. All works fine except these three fields. Which I'd like to use to calculate the number of line posts and line post spacing. This one sounds simple, right? Nope. I cannot seem to get the right formula.
I'll explain a bit further. I have 3 fields. Field #1 named Footage. Field #2 named LinePosts. Field #3 named Spacing. So, I enter the footage then I want to have the two other fields to make their individual calculations. LinePosts should calculate then show the number of posts, then the Spacing field would calculate then show the post spacing.
Now, typically when building a fence the line post spacing cannot be greater than 10' apart (keep this in mind).
Example: For 200' (Footage) the line post spacing would be 10' apart and would take 19 posts giving you 20 spaces for that line (20x10=200'). But, if the Footage entered is 72' then the line post spacing would be 9' apart and would take 7 line posts giving you 8 spaces (8 x 9=72'). But, if the Footage entered is 38' then the line post spacing would be 9'6" and would take 4 spaces (4 x 9'6"=38'). And so on.
I'm not a Acrobat novice but definitely not an expert either. Far from it. And, I always seem to figure it out, but not when it comes to these three fields. I have tried Simplified field notation and/or Custom calculation script and just can't get it right. I'm thinking perhaps Javascript.
Perhaps you guys can help me with this issue? I'm on a Mac and use Acrobat Pro 9.
Thank you for taking the time to read this post.
You will find the spacing by dividing the footage by the footage divided by 10 and rounding up to the next whole number.
Once you find the spacing then the number of post becomes the footage divided by the spacing less 1.
The calculation for the spacing:
event.value = '';
var Footage = this.getField('Footage').value;
if(Footage >0)
event.value = Footage / Math.ceil(Footage/10);
The calculation for the number of post:
event.value = '';
var Footage = this.getField('Footage').value;
if(Footage >0)
event.value = (Footage / (Footage / Math.ceil(Footage/10)) ) - 1;
The results for the spacing is in feet.
George Kaiser