 Level 1

0% to Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

SOLVED

## FormCalc conditional sum problem  Level 1

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?

FormCalc
1 Accepted Solution  Level 10

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

;Calculate Amount Due Traveler
else
0
endif``````

and For the Amount Due University, it's simply the opposite

``````Amount Due University :: calculate - FormCalc

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.

2 Replies  Level 10

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

;Calculate Amount Due Traveler
else
0
endif``````

and For the Amount Due University, it's simply the opposite

``````Amount Due University :: calculate - FormCalc

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.  Level 1

Oh my gosh, thank you! I'd tried everything, but making some adjustments, this is what worked:

Total due traveler:

else 0
endif

Total due university:  