Feedback

  • Contents
 

Tips for Custom Calculations

Creating custom calculations is very tricky unless you are a programmer or mathematician. Because you are entering calculations directly, you risk creating calculations with three different kinds of errors:

  • First, your calculation might have a syntax error. This is annoying, but it's the least serious kind of error because IPA Designer will detect it and refuse to accept the calculation until you correct the error.

  • Second, your calculation might have a run-time error. IPA Designer often cannot detect this kind of error because it does not show up until you actually run the process on your CIC server. Your expression might refer to a file that is missing, for example. This is more serious because it interrupts your process when employees are trying to use it.

  • Third, your calculation might have a logical error. This is the most serious kind of error because it means that your process appears to work correctly, but does something other than what you want it to do and it gives incorrect results. IPA Designer cannot detect this kind of error because it only knows what you tell the process to do, not what you want it to do.

One of the most important things you can do is to use parentheses to group the parts of your calculation. For example:

if (CurrentBalance > 1000 AND PaymentsUpToDate) OR GoldCustomer

is different from

if CurrentBalance > 1000 AND (PaymentsUpToDate OR GoldCustomer)

When your calculation has nested parentheses, IPA calculates the result by staring on the inside and working its way to the outside. Consider this simplified example:

( (3 + (5-7)) * 100 )

IPA would calculate the result by:

  • Subtracting 7 from 5 to get negative 2. Notice that it starts inside the innermost parentheses.

  • Adding negative 2 to 3 to get 1. It has now worked outward one level.

  • Multiplying 1 by 100. It finally does the calculation in the outermost parentheses.

Best practice: If you need custom calculations, have a programmer, software engineer, or mathematician create them to minimize the risk of errors.