Expand my Community achievements bar.

How do I make a calculated field default to zero if the answer is negative

Avatar

Former Community Member

I have a field that is a calculated field.  Currently my formula (formCalc) for the field "Need" is just $ = Budget - EFC.  This works fine until the EFC field is higher than the Budget, in which case I get a negative number.  I would like for "Need" to be zero if the calculation results in a negative number.  I am pretty new at this.  Can anyone help me?

Thank you

Michelle

7 Replies

Avatar

Level 6

how about something like this?

if(need.rawValue<0)then

need.value="0"

endif

Avatar

Former Community Member

Do I leave the original formula as well?

Michelle Smith

Financial Aid Advisor

Western Texas College

6200 College Ave

Snyder, TX 79549

325-574-6598 (phone)

866-270-6184 (fax)

msmith@wtc.edu

Avatar

Former Community Member

Do I need to keep the original formula as well? 

Avatar

Level 6

Try this:

if (Budget - EFC < 0) then

    Need = 0

else

    Need = Budget - EFC

endif

Avatar

Former Community Member

I get a script failed:

Error: accessor 'Need' is unknown.

Avatar

Former Community Member

Sorry,  I figured out the problem.  Thank you!  The formula worked just great!  I appreciate your help.

Avatar

Level 6

It is formCalc and be sure the field names match the script names.  (no "" around Need)