How should I debug to see what's happening exactly in my formulas?

Hello,

 

One of my client is operating some models which drives a connect Supply Chain Network, and they need a stepwise debug execution so as to see what's happening exactly in the formulas. Due to the fact that most of formulas are bid over complicated, step by step debug execution would be nessary.

Any ideas and comments would be highly appreciated.

 

Best regards,

Hisashi Yamaguchi

Answers

  • Hi,

     

    Often I'll paste the formula into a text editor (or MS Word), add carriage returns to make the reading of the formula easier, and then test pieces of it separately.  If I'm the one creating the (very long) formula, I will generally always document the formula in the aforementioned way, and provide some simple notes on what it does.  

     

    For me, ultra long formulas are an indicator of poor architecture... not determinitive, just an red-flag.  If I have time on the project, I'll go back and rethink very long formulas with a focus on simplification.  ...there's almost always a simpler way in Anaplan; we just have to find it.  To simplify, I'll look for opportunities to break the formula out into separate line items (not always possible if the model is very large), as well as unwind complex nested logic in favor of a mapping or lookup.

     

    Cheers!

     

    paul

  • Simplification can be acheived by structuring common/system data is systems modules which are used acrosss all formulas. 

    Examples of systems module groups: 

    1. Time settings,
    2. Hierarchy details, attributes,
    3. Mappings,
    4. Filters,
    5. User lists
  • Echoing what @PaulRitner said, copying out to another editor helps; I often colour code the different sections too.

     

    I would add that best practice is to split the formula into separate line items for easy of understanding, maintenance and better performance.  This is especially true if there are a lot of repeated expressions within the formula.  Use a "find" search to look for repetition, move those elements to new line items and then reference them.  The calculation will perform much better.

     

    See here for more information:

    https://community.anaplan.com/t5/Shared-Best-Practices/Reduce-Calculations-for-Better-Performance/ta-p/33667

    https://community.anaplan.com/t5/Shared-Best-Practices/Formula-Structure-for-Performance/ta-p/33177

     

    David