I have a dollar amount box x26 = annual payroll deduction and tried to write a java script to automatically come up with the annual payroll deduction and I keep getting error messages. I am using the annual payroll deduction in another calculation which works could that be the problem? Does anyone have a sight were I can read to find out what I am doing wrong?
Solved! Go to Solution.
Views
Replies
Total Likes
Here you go. I put the script in the calculate event of F1. When doing any scripting it's important to match the syntax of the field name exactly. When working with whatever value is in the field, the correct syntax is fieldName.rawValue (i.e., F1.rawValue, F9.rawValue). I also renamed f9 to F9. There's no real reason to do this other than for your own convenience, to be consistent with your fieldnames.
Views
Replies
Total Likes
Can you post the error message so we can see what the message is?
Paul
Views
Replies
Total Likes
Script failed (lanuage is formcalc; context is
xfa[0].form[0].topmostSubform[0].page1[0].F1[0]
Script=ifN1=N9*N10 end if
Error;syntax error near token 'N1' on line 1, column 5
Views
Replies
Total Likes
That is not a valid syntax ......it shoudl look like this:
if (whatever your condition you are testing is) then
N1=N9*N10
endif
Paul
Views
Replies
Total Likes
Obviously I am very new at this. What is "Whatever your dondition you are testing is"?
Views
Replies
Total Likes
The condition you're testing for is whatever let's you know that you want to multiply N9*N10. So if that only applies to people who make more than $50,000/year then your script would be:
if (income > 50000) then
N1 = N9 * N10
endif
In this case, the condition being tested is whether or not the user's income is greater than $50,000.
Views
Replies
Total Likes
What if it is a simple equation. There are no conditions it is whatever the user puts, how much they want deducted from the paycheck times the 26 weeks. It could be any number.
Views
Replies
Total Likes
You would use the name of the deduction field in your equation, something like:
this.rawValue = (deduction.rawValue * 26);
for javaScript, or:
this.rawValue = deduction * 26
for FormCalc
Views
Replies
Total Likes
No won't work. Can you look at it and see what I am doing wrong?
Views
Replies
Total Likes
Here you go. I put the script in the calculate event of F1. When doing any scripting it's important to match the syntax of the field name exactly. When working with whatever value is in the field, the correct syntax is fieldName.rawValue (i.e., F1.rawValue, F9.rawValue). I also renamed f9 to F9. There's no real reason to do this other than for your own convenience, to be consistent with your fieldnames.
Views
Replies
Total Likes
Thank you so much I learned a lot. Is there somewhere you can learn these things or a book you know of?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies