Hi - I'm a newbie to LiveCycle Designer and only have limited knowledge of coding.
I have a form that is used to determine cost based on the age. I am unable to get the FormCalc syntax to operate properly.
This is what I have so far:
var ARate
var cost
if ( not VolEEAmount.isNull ) then
if ( InvisibleEEAgeCalField.rawValue < 29) then ARate eq ".0075";
elseif ( InvisibleEEAgeCalField.rawValue > 29 and InvisibleEEAgeCalField < "34" ) then ARate eq ".001";
endif
cost = ( ARate * VolEEAmount.rawValue )
else
cost = ""
endif
VolEEAmount is a numeric field and where the person enters a number. The number they enter will drive the calcuation of how much they need to pay
InvisibleEEAgeCalField is an invisible numeric field where I've determine the person's age. It's hidden for all views.
What am I doing wrong? Any tips is welcomed Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
I resolved it through my mentor. Here's the fix I got:
if ( HasValue(VolEEAmount) ) then
if ( Within(InvisibleEEAgeCalField.rawValue, 0, 29) ) then 0.000075 * VolEEAmount.rawValue else
if ( Within(InvisibleEEAgeCalField.rawValue, 30, 35) ) then 0.000100 * VolEEAmount.rawValue else
0.000200 * VolEEAmount.rawValue
endif
endif
else
Null
endif
Good luck and hope this will help someone in the future.
Views
Replies
Total Likes
what are you doing with the value of your variables once the script is complete? At the moment they are not showing anywhere. Also where have you put this script?
Views
Replies
Total Likes
Thanks for your response!
Let me add some more info:
Say my birthday is 02/28/1980. It's entered in a date/time field.
I want to elect 100,000 coverage in life insurance. The rates are as follow:
Beginning Age | Ending Age | Rate (monthly) |
0 | 29 | .000075 |
30 | 34 | .000075 |
35 | 39 | .000105 |
40 | 44 | .000155 |
45 | 49 | .000225 |
50 | 54 | .000415 |
55 | 59 | .000645 |
60 | 64 | .000735 |
65 | 69 | .001255 |
70 | 74 | .003075 |
75 | 99 | .012005 |
My age = 32 --> refers to the table the rate is .000075
I have a hidden field called "InvisibleEEAgeCalField" that uses another FormCalc code to determine age. The syntax is as follow:
if ( not EEInfoSubform.EEInfoTable.Row1.DOB.isNull ) then
var dateofBirth = Date2Num( EEInfoSubform.EEInfoTable.Row1.DOB, "YYYY-MM-DD" )
var currentDate = Date()
var years = ( currentDate - dateofBirth ) / 365
$ = Floor( years )
else
$ = ""
endif
I input "100,000" into a numeric field call "VolEEAmount"
I want the numeric field called "VolEECost" to display the calculation below:
rate of .000075 multiple by the "VolEEAmount" [.000075x100,000] -> display 7.50 in the numeric field "VolEECost"
Views
Replies
Total Likes
Hello Everyone - I simplified my logic statements.
What is wrong with this syntax?
var ARate = .000075
var BRate = .0001
var age = if ( HasValue(EEInfoSubform.EEInfoTable.Row1.DOB) ) then Floor( ( Date() - Date2Num( EEInfoSubform.EEInfoTable.Row1.DOB, "YYYY-MM-DD" )) / 365 ) else Null endif //this give me the age
var Rate = if ( age < 29) then ARate elseif ( age > 29 and age < 34 ) then BRate endif //this sets the rate
if ( HasValue(VolEEAmount) ) then
Rate * VolEEAmount.rawValue
else
NULL
endif
Views
Replies
Total Likes
I resolved it through my mentor. Here's the fix I got:
if ( HasValue(VolEEAmount) ) then
if ( Within(InvisibleEEAgeCalField.rawValue, 0, 29) ) then 0.000075 * VolEEAmount.rawValue else
if ( Within(InvisibleEEAgeCalField.rawValue, 30, 35) ) then 0.000100 * VolEEAmount.rawValue else
0.000200 * VolEEAmount.rawValue
endif
endif
else
Null
endif
Good luck and hope this will help someone in the future.
Views
Replies
Total Likes
Views
Likes
Replies