Add Syntax Highlighting

Add Syntax Highlighting

As a Model Builder, I would like to have "syntax highlighting" when I create my formulas in order to improve readability.

The content in this article has not been evaluated for all Anaplan implementations and may not be recommended for your specific situation.
Please consult your internal administrators prior to applying any of the ideas or steps in this article.
15 Comments
Community Manager

Jeremy,

 

Thanks for the idea and screenshot.  We are moving your idea to 'acknowledged'.  We encourage the Community to provide addtional feedback and support for the idea.  

Status changed to: Needs Community Support
New Contributor

I can't stress enough how important this would be to all model builders on the team. I would only like to point out that while the colorful highlighting is nice to have, the ability to add new line & indent while reading or editing the formula (similarly to how formulas are currently displayed when using Drill Down) would drastically improve readability by itself. This would be a huge quality of life improvement as going back to edit/read/understand/rewrite lengthy formulas would become much easier.

Community Manager
 
Status changed to: Under Investigation
Community Boss

This is also on my personal wishlist.  Something to be able to more easily read through nested IF statements, and other more complex formulas would be great.  I also really want the indention that is shown in the screenshot.  Here is my personal screenshot for what it's worth.

Anaplan - Formula Syntax.PNG

Occasional Contributor

Fully agree with this huge improvement even we recommand to limit the length of formula in some case we can do differently.

 

Contributor

100% agree with Jeremy and David.  Imagine reading a book on a continuous scroll, with all of the paragraph and

line breaks removed.  That's the best analogy I can think of for the current editor.

Occasional Contributor

Completely agree with the above. A lot of model builders come from a world familiar with MS Excel which is still dramatically better in the formula writing area than Anaplan is currently when it comes to ease of use.

Occasional Contributor

I want to add another important enhancement to formula editor. For long formulas (1+ word pages) it is quite necessary to have in-text comments, as in other programming languages. So for example everything between $some symbols$ is ignored by system, but visible to modeler and thus helps with development and support.

Contributor

Agree

Community Boss

Will be extremely useful, mostly when a model is big and a small error in the formula syntax can take some minutes! 

Certified Master Anaplanner

Agreed! It would be helpful if the tab spacing was preserved.

 

As a workaround I made my own color mapping to use in Notepad++ . For larger complex builds, I do all my formula writing in Notepad++ then paste it into Anaplan so that way I have a library of line formulas to view and debug. If anyone is interested in the formatting file for Notepad++ I can send it.

Capture.JPG

Contributor

R language Mac Vim highlighting.pngR language syntax highlighting in Mac Vim

I also use an external editor (Mac Vim) to get color coding; I just tell it the file is in the R language; I ought to build a custom file to improve how it looks, however, because right now it is very rudimentary and dependent on the use of quotes.  If you could upload the Notepad++ color settings (in some form), I am sure Windows model builders would appreciate it.

 

 

PS.  In a module, /data/drill down will format a formula with white space including line breaks for easier readability -- but all black and white.drill down.png

 

Certified Master Anaplanner

Doesn't seem to be a file upload function on community. If anyone wants to load it,  paste this code into Notepad and save the file with an .xml extension. You can then import this as a user defined language in Notepad++.

 

For the dark background in my screen shot I use the dracula theme: https://draculatheme.com/notepad-plus-plus/

 

 

<NotepadPlus>
    <UserLang name="Anaplan" ext="anaplan" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00&quot; 01 02&quot; 03 04</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2"></Keywords>
            <Keywords name="Numbers, extras1"></Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">ABS ADDMONTHS ADDYEARS AGENTS AGENTSB ANSWERTIME ARRIVALRATE AVGDURATION AVGWAIT BLANK CODE COLLECT COMPARE CUMULATE CURRENTPERIODEND CURRENTPERIODSTART CURRENTVERSION DATE DAYSINMONTH DAY DAYS DAYSINYEAR DECUMULATE DIVIDE END ERLANG-B ERLANG-C EXP FIND FINDITEM FIRSTNONBLANK FIRSTNONZERO FV HALFYEARTODATE HALFYEARVALUE INPERIOD IRR ISACTUALVERSION ISANCESTOR ISBLANK ISBLANK ISCURRENTVERSION ISFIRSTOCCURRENCE ISNOTBLANK ISNOTBLANK ITEM LAG LASTNONBLANK LEAD LEFT LEN LENGTH LN LOG LOOKUP LOWER MAILTO MAKELINK MAX MID MIN MOD MONTH MONTHTODATE MONTHVALUE MOVINGSUM MROUND NAME NEXT NEXTVERSION NPER NPV OFFSET PARENT PERIOD PMT POST POWER PREVIOUS PREVIOUSVERSION PROFILE PV QUARTERTODATE QUARTERVALUE RANK RANKCUMULATE RATE RIGHT ROUND SELECT LOOKUP SIGN SLA SPREAD SQRT START SUM SUM &amp; LOOKUP SUM &amp; SELECT TEXT TEXTLIST TIMESUM UPPER VALUE WEEKDAY WEEKTODATE WEEKVALUE YEAR YEARTODATE YEARVALUE ( )</Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open"></Keywords>
            <Keywords name="Folders in code2, middle"></Keywords>
            <Keywords name="Folders in code2, close"></Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">IF&#x000D;&#x000A;NOT&#x000D;&#x000A;THEN&#x000D;&#x000A;ELSE&#x000D;&#x000A;TRUE&#x000D;&#x000A;AND&#x000D;&#x000A;OR&#x000D;&#x000A;&lt;&#x000D;&#x000A;&gt;&#x000D;&#x000A;&lt;&gt;&#x000D;&#x000A;&lt;=&#x000D;&#x000A;&gt;=&#x000D;&#x000A;&#x000D;&#x000A;</Keywords>
            <Keywords name="Keywords2">+&#x000D;&#x000A;-&#x000D;&#x000A;*&#x000D;&#x000A;/&#x000D;&#x000A;=</Keywords>
            <Keywords name="Keywords3"></Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00[ 01 02] 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="FF8080" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="FFFF00" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="FF962D" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="00FF80" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="FFFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="CAFFFF" bgColor="000000" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>
Certified Master Anaplanner

Aside from coloring, another thing I really like about Notepad++ is the ability to set up parenthesis color matching. When I put my cursor next to a parenthesis it'll highlight the matching open and close. This is super handy when I have gnarly nested IF functions or many logical arguments in a formula. If Anaplan has syntax highlighting in the works please include this feature!parenthesis matching.JPG

 

 

Community Manager
 
Status changed to: Considered for Future Roadmap