Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Custom Script to Calculate Date to Percentage
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Custom Script to Calculate Date to Percentage

 Post Reply Post Reply
Author
Charlooney View Drop Down
New Member
New Member
Avatar

Joined: 21 Feb 2017
Points: 2
Post Options Post Options   Quote Charlooney Quote  Post ReplyReply Direct Link To This Post Topic: Custom Script to Calculate Date to Percentage
    Posted: 21 Feb 2017 at 6:24pm
Hello all,

I have been beating my head against a wall trying to sort the very last formula in the form I am designing. I'm under a bit of a time crunch, so any help is very very much appreciated.

My form is being used to calculate a percent payable amount in relation to hours of the day. For example:

Start Time = 12:00, Finish Time = 14:00, thus 8% of the day is the calculation result and the amount payable.

However, for events that run multiple days it would look something like this:

Line 1 - Start Time = 12:00, Finish Time = --, 50% payable
Line 2 - Start Time = --, Finish Time = 12:00, 50% payable

I have the simple notations for the calculation above, not a problem, but cannot get these both to work together (to ensure that the formula is present if anyone should have a start and finish time in the same day).

In addition, if neither the Start Time, nor the Finish Time is present, I need the default value to be 100% (I've set this in the Options Tab, but it disappears as soon as there is a calculation present).

I've been playing with an if, else in the script, but am wondering if the default to 100% needs to be a formatting script instead? If so, I would need to ensure it is formatted as a percent, but calculates as a number.

I feel like this may be an easy solution that I am over thinking. Any help is greatly appreciated; Many thanks!

Warm Regards,
Charlene

Back to Top
Sponsored Links


Back to Top
Charlooney View Drop Down
New Member
New Member
Avatar

Joined: 21 Feb 2017
Points: 2
Post Options Post Options   Quote Charlooney Quote  Post ReplyReply Direct Link To This Post Posted: 23 Feb 2017 at 5:35am
Hello all,

An update to say that I have sorted the 100% issue with a handy formatting script, so no worries.

I am at war with the last bit though ...

I no longer need these to work together -- only a calculation IF either Start Time or Finish Time is input.

Due to the formulas required to get the overall percentage, this cannot be done via a simplified notation, it must be a custom script.

My starting point formulas, to get the correct percentage for the Start Time (the amount remaining in the day) and FinishTime (the amount of the day that has elapsed):

(StartTimeRow1/24-1)
(FinishTimeRow1/-24)

I believe I need an IF statement to get either one to show, so IF Start Time is greater than 0, then the final value is (StartTimeRow1/24-1). Then an else if, very similar for the Finish Time.

However, every script I write results in zero calculation. Head. Desk.

Many thanks for anyone who can offer assistance, my brain is fried!!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.015 seconds.