FormCalc conditional sum problem

jparris67

18-12-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Magus069

MVP

18-12-2019

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.

 

Answers (0)