Replace If/Else with Write
Recommendation (LOW)
Replace an If/Else activity with a single Write activity that uses the IF expression function.If you are using an If/Else activity to calculate one or more values based on a series of conditions, replace it with a single Write activity. The Write activity can use the IF expression function to write different values depending on a condition, thereby reducing execution time and memory usage.
Example
If/Else activity with two branches:
- Branch 1:
- condition of a > 10
- writes a value of valid to a local variable
- Branch 2:
- condition = none
- writes a value of invalid to the local variable
- Value can be replaced by a single Write activity to the local variable with this expression:
- IF(a > 10, “valid”, “invalid”)
Figure 3
Figure 4