Adding a switch statement formula to Anaplan to get rid of long nested IFs!
This would assist in readability (and therefore maintenance) of complex formulae.
Switch statements allow you to test a condition, and assign an outcome to each condition.
For instance you may have want to test what mode of transport is being used: car, boat, or aeroplane.
Using an IF statement your formula may look like this:
IF Transport = Modes.Car THEN Car Outcome ELSE IF Transport = Modes.Boat THEN Boat Outcome ELSE IF Transport = Modes.Aeroplane THEN Aeroplane Outcome ELSE BLANK
The nested IFs cause Anaplan to check each condition in turn and doesn't represent the underlying logic of the calculation. You want one mode of transport to map to one condition, and not cycle through all conditions.
A switch could look like this:
SWITCH Transport CASE Modes.Car: Car Output CASE Modes.Boat: Boat Output CASE Modes.Aeroplane: Aeroplane Output CASE DEFAULT: BLANK
This also allows a model building to add a default, or exception, case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.