Expand my Community achievements bar.

Is conditional formatting possible?

Avatar

Level 2

I've been scanning the forums for an answer to this question but haven't been successful.

I am trying to program my form (it's a Travel Expense Reimbursement form) so that one of two fields will auto populate with information from another cell, based on what type of number is in the cell (a positive or a negative dollar amount).

For clarity:  the entire worksheet has numeric fields which add up into a read only field titled "TripTotal".  There are three user-entry fields ("LessPrepaid", "Less Personal" and "Less Advance") that are to be subtracted from "TripTotal". This amount will be calculated into a field titled "Balance".

What I cannot figure out is:  If "Balance" amount is a negative, I need the field "AmtReturned" to populate.  If the amount is a positive, I need the field "AmtReimbursed" to populate.

Can this be accomplished simply?

Thank you for your help & ideas...

AmandaVor

1 Reply

Avatar

Level 10

You just need an if statement on the Calculate event of the Balance field.

Something along the lines of:

form1.#subform[0].Balance::calculate - (JavaScript, client)

if (this.rawValue < 0) {
    AmtReturned.rawValue = this.rawValue;
    }
else {
    AmtReimbursed.rawValue = this.rawValue;
    }