I am trying to get a percentage box added to my form where the percentage difference between the old and new salary is populated based on the old and new bi-weekly salarys. This is a general idea of what I am looking for:
Old Bi-weekly Salary | (entered by user) | Annual Salary | (Autopopulates biweekly salary *26) | ||
New Bi-Weekly Salary | (entered by user) | Annual Salary | (Autopopulates biweekly salary *26) | Percentage Difference | (need to populate % diff based on difference between old and new salaries) |
Can someone please help me to get this to work? I cant seem to get it to work without messing up my autopopulated annual payout field.
Thanks in advance
Misti
Views
Replies
Total Likes
I always have to look up percentages...found a good page here on calculating percentage change: http://www.mathsisfun.com/numbers/percentage-change.html
So basically the new value divided by the old value times 100 then subtract 100.
Using FormCalc on the Calculate event of the field:
if (HasValue(newSalaryField) & HasValue(oldSalaryField)) then
((newSalaryField/oldSalaryField) * 100) - 100
endif
Views
Replies
Total Likes
Hi,
First make sure that the percentage object is a numericField.
if we work on the basis that the objects are named "oldSalary" and "newSalary", then the following JavaScript in the calculate event of the percentage object should work:
// first check that neither salary object is null
if (oldSalary.rawValue != null && newSalary.rawValue != null)
{
this.rawValue = (newSalary.rawValue - oldSalary.rawValue) / oldSalary.rawValue;
}
Then in the Object > Field palette, click on the Patterns button. There is a percentage display pattern, which you can select and then adjust to how many decimal places you want it display to.
Hope that works/helps,
Niall
It's like busses, you wait for ages and then two come along at the same time
Views
Replies
Total Likes
Oh my gosh!!! It worked!! Thank you so much for your help!!!!!
You made my day
Thanks,
Misti
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies