Home > FAQ > Database > If statements in Define Field by Expression

If statements in Define Field by Expression

QUESTION: I want to calculate a field for my J&S percentage, but only for records with payment form "J&S". How can I do an "IF" statement in ProVal (if "J&S", then calculate, else do nothing)?

ANSWER: Selection Expressions take the place of "IF" statements in ProVal. In Define Field by Expression, only those records meeting the selection criteria are changed. Consider the J&S percentage example above, and suppose that PmtForm = 2 is the code for "J&S". The solution might look like:

Field to Define: JSPct

Expression: SpouseBft / MemberBft

Selection Expression: PmtForm = 2