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.

44 Comments
Stan
Honored Contributor

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: Your support is needed
mshcher
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.

Rebecca
Valued Contributor
 
Status changed to: Under Investigation
DavidE
Super Contributor

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

gvannier
Occasional Contributor

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

 

schulze
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.

Patrick
Occasional Contributor

Hi everyone

It will be helpful to have the arguments of a formula in a bubble (see the screenshot) while using that formula into the formula bar (much like in Excel). This will make understanding and learning easy.

 

Regards,

 

Patrick

Miran
Super Contributor
 
Status changed to: Your support is needed
nicarter
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.

Vlad
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.

Sukh_Sandhu
Contributor

Agree

Manuela_Apostol
Certified Master Anaplanner

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

cpham
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

schulze
Contributor

R language syntax highlighting in Mac VimR 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

 

cpham
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>
cpham
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

 

 

obriegr
Certified Master Anaplanner

When editing a formula, if you click the drop down/pivot double area have the formula display with indents for if-then-else statements, row numbers, and coloring (if possible allow adding in comments).

 


Making clear what is a key word, what is a module, line item, when/where brackets/parenthesis begin and end, and auto-fill when you start typing out names of each piece (eg. I start typing Time, with a T and all the module names, lists, and key words start to populate as a list below that is click able)

Miran
Super Contributor
 
Status changed to: Your support is needed
Rebecca
Valued Contributor
 
Status changed to: Under Investigation
Rebecca
Valued Contributor
 
Status changed to: Under Investigation
shamkataria
Occasional Contributor

When entering a formula or you have completed a formula and line items references by it are highlighted or shading in a conditional format when in the formula bar - similar to excel. This would really help when you have similarly named line items or really long formulae.

Miran
Super Contributor
 
Status changed to: Your support is needed
Rebecca
Valued Contributor
 
Status changed to: Considered for Future Roadmap
MMAD
New Contributor

Look in attached picture for example showcasing the problem -> How it works in excel. Look for syntax within red circle.

Miran
Super Contributor
 
Status changed to: Your support is needed
Ari
Contributor
Contributor

Hi,

 

I believe this would be a very impactful tool for model builders and power users. The idea is to help write or verify a formula. In its most basic form, the tool would auto-indent formulas just like in an app like xcode:

 

IF

         X = Y

         AND

        BooleanVariable

THEN

        VariableX[

               LOOKUP : LineItem

        ]

ELSE

      VariableY[

              SUM : LineItem

      ]

 

A little version of that is already available in the drill-down functionality. In fact, I tell clients to use the drill-down functionality to check their formulas. If only the basic indentation of the drill-down menu would appear when you re-open the formula input field, already this would be a big improvement. Then if colors are added, it would make it even better. I suspect, doing this may require a level of syntax check as you enter the formula. This would go hand in hand with several other requests to check the syntax before submitting a formula, one of which is already on the roadmap:

 

https://community.anaplan.com/t5/Idea-Exchange/Alert-Model-Builders-of-Incorrect-Formulas-References...

 

A sort of formula builder that helps you structure a formula, analyze an existing large formula, and check the syntax would save a lot of time.

 

There are a few browser plug-ins circulating, to help with basic indentation of IF statements, which highlights the need for such a tool.

 

Thank you,

 

 

CallumW
Super Contributor

Love this suggestion @Ari !

DavidSmith
Community Boss

We are looking at what we can do in this area!

Miran
Super Contributor
 
Status changed to: Your support is needed
s.jansenidw
Contributor

There is a third-party chrome plugin available made by a french consulting company. I fully agree that this should be incorporated into the platform but untill that is the case the chrome plugin really works for me. It includes indentation and color coding and even fills your formulas (when you start typing). You can find it on: https://chrome.google.com/webstore/detail/a%20-for-anaplan-model-buil/najhicgfojolaebaoccdbopmobcdhp... 

ablack
Certified Master Anaplanner

There are some tools that exist that work pretty well, but aren't automatically updated (need to maintain formulas, etc), but I agree this would a massive value add for model builders.

 

Considering Anaplan is formulated in English to an extent, having a similar approach to Python syntax and linting would be the best, in my opinion. Use tabs for nested functions, highlighting, and checking for completed parenthesis, etc.

DavidSmith
Community Boss

Can I just re-iterate that this plug-in is not officially supported

Gwen.pryor
Regular Contributor
 
Status changed to: Under Investigation
schulze
Contributor

+1 for Python-style syntax.

otalpur
Certified Master Anaplanner

There is a Chrome add-in called "A+ for Anaplan (Model Builder Edition)" that has worked for me pretty well over the past couple months in accomplishing some of these request. I would check it out. It does nested If/then statements; color codes items; and allows you to search for line items and names when typing out a formula. One thing to note: It only works when your formula bar is locked to the left side of the screen.

I hesitate to share because as it is maintained by a 3rd party and not Anaplan, I don't want this removed from the roadmap as the 3rd party could stop supporting the add-in whenever they feel like it. 

Vlad
Contributor

As for Chrome extensions we cannot use them unless they are maintained by Anaplan company or another secure developer, as we found out they have access to models meta-data. So please keep built-in highlighting on the roadmap.

Igor
New Contributor

+1, such functionality would remove a lot of pain and improve efficiency

Dear @Rebecca , status of this idea was changed to "Considered for Future Roadmap" a year ago - is there any progress on a topic?

AndreyT
New Contributor

+1 to: such functionality would remove a lot of pain and improve efficiency

Cool features are always welcome especially when they are saving time.

dan.fleming
Contributor

I too use the A+ for Anaplan (Model Builder Edition) extension for Chrome. I have found it to be incredibly helpful for long and complex formulas (especially for IF statements). I have also found it valuable particularly useful when teaching new Anaplan users the syntax used within Anaplan.

 

The extension is useful, but would be great to have this included natively for a more seamless experience specifically around highlighting which variable of the function you should be entering as you go.

Vlad
Contributor

As I remember the Chrome extention was not approved by Anaplan company. Once we found the extention too, but discovered it can send the meta data of the models somewhere. So it is not secure and not a valid workaround.

This would be a fantastic update to the platform. In the meantime, there are chrome add-ons you can leverage like A+ for Anaplan and Anaplan Formula Helper. They can be a little wonky at first, but once you get the hang of them it makes auditing long complex formulas much more manageable. 

ChrisM
Contributor

The New Modeling Experience launched recently includes our first iteration of syntax highlighting. We hope to be able to add auto-indentation capabilities in a future version. 

Status changed to: On Roadmap
GeorgeDuckett
Regular Contributor

FYI I've created a chrome extension that adds this and many other features. I've got a post about it here: https://community.anaplan.com/t5/Anaplan-Platform/Better-Formula-Editor-for-Anaplan-A-new-Chrome-Ext...

ChrisM
Contributor

This is now available in the New Modeling Experience

Status changed to: Delivered