I have a travel reimbursement form with numeric fields for all expenses and cash advances. I have two fields for totals: one for "Amount Due Traveler" and one for "Amount Due University." I need for the Total Expenses and Advances fields to be compared, and if Expenses are greater than Advances, the Amount Due Traveler should sum and leave the other field at $0. If the opposite is true, the Amount Due University should sum and leave the other field at $0.
I've tried different if then else statements and nothing seems to be working. I've done a lot of research and can't seem to find the answer.
What would be the proper way to write this in FormCalc?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi there,
I can't directly give you the solution at hand without the object references. Without the hierarchy, all I can give you is the syntax on how to make this work.
So technically, you need a calculate event for each fields which you need to input a calculated value or 0$, both will have the same syntax, but different outcome.
For the Amount Due Traveler it should look something like the following:
Amount Due Traveler :: calculate - FormCalc
if (Expenses gt Advances) then
;Calculate Amount Due Traveler
else
0
endif
and For the Amount Due University, it's simply the opposite
Amount Due University :: calculate - FormCalc
if (Expenses gt Advances) then
0
else
;Calculate Amount Due University
endif
You can always provide a screenshot with the hierarchy and the code you are testing if you need any more assistance.
You can always refer to the FormCalc User Reference for any question on how to use the language
I hope this will help.
Hi there,
I can't directly give you the solution at hand without the object references. Without the hierarchy, all I can give you is the syntax on how to make this work.
So technically, you need a calculate event for each fields which you need to input a calculated value or 0$, both will have the same syntax, but different outcome.
For the Amount Due Traveler it should look something like the following:
Amount Due Traveler :: calculate - FormCalc
if (Expenses gt Advances) then
;Calculate Amount Due Traveler
else
0
endif
and For the Amount Due University, it's simply the opposite
Amount Due University :: calculate - FormCalc
if (Expenses gt Advances) then
0
else
;Calculate Amount Due University
endif
You can always provide a screenshot with the hierarchy and the code you are testing if you need any more assistance.
You can always refer to the FormCalc User Reference for any question on how to use the language
I hope this will help.
Oh my gosh, thank you! I'd tried everything, but making some adjustments, this is what worked:
Total due traveler:
if (TotalExpenses gt Advances) then
Sum(TotalExpenses-Advances)
else 0
endif
Total due university:
if (TotalExpenses lt Advances) then
Sum(Advances-TotalExpenses)
else 0
endif
Thanks again!
Views
Replies
Total Likes
Views
Likes
Replies