Skip to Content

In the forum there are several questions how to set up custom syntax recognition for preferred advanced text editor. BPC standard script editor was enhanced in 7.5 and syntax highlighting was introduced. However, the general usability of the editor itself is still not best-in-class when it comes to coding environments.

There are several text editors that let you choose syntax highlighting and possibly error correction. My preference is Notepad++ and I have created custom syntax for both Script Logic and MDX. Of course, you can do MDX directly in SQL Manager or BIDS but most of the time you just may want type something in to have it field-tested later.

Here is how to configure Notepad++ to recognize Sript Logic. Copy the following to %USERPROFILE%\AppData\Roaming\Notepad++\userDefineLang.xml (File location may vary by operating system and setup, this applies to Windows 7 and default N++ setup):

<NotepadPlus>
    <UserLang name="BPC" ext="lgl lgf">
        <Settings>
            <Global caseIgnored="yes" />
            <TreatAsSymbol comment="no" commentLine="yes" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters">%&quot;0%&quot;0</Keywords>
            <Keywords name="Folder+">*add *begin *for *function *selectcase *when *sub</Keywords>
            <Keywords name="Folder-">*endadd *end *next *endfunction *endselect *endwhen *endsub</Keywords>
            <Keywords name="Operators">( ) &lt; = &gt;</Keywords>
            <Keywords name="Comment">1 1 2 2 0//</Keywords>
            <Keywords name="Words1">*add_dim *calc_org *calc_dummy_org *xdim_noscan *noscan *calc_each_period *calculate_difference *clear_destination *commit_each_level *commit_each_member *commit_max_members *commit *destination *destination_app *first_period *flag_period *go *include *join *last_member *local_currency *logic_by *logic_mode *logic_property *lookup *endlookup *measures *memberset *no_paraller_query *prior *process_each_member *process_fac2 *put *query_filter *query_size *query_type *rename_dim *run_stored_procedure *runlogic *scope_by *select **select *skip_dim *store_org *syslib *use *test_when *write_to_fac2 *write_to_file *xdim_addmemberset *xdim-default *xdim_filter *xdim_detinputset *xdim_getmemberset *xdim_noscan *xdim_maxmembers *xdim_member *xdim_memberset *xdim_required *case *rec</Keywords>
            <Keywords name="Words2">roa roe roce cts npm gpm smgaexps atr artr acp itr aai sta daysrec dayspay daysinv dr dter icr dcr epc per bvps mbr dy dp mon pro movement movement2 firstprev fxdiffnetincome funallloc entityalloc openbalance prevbalance dynamicopenbalance rolltobs accumulate translate_ldi calc_movement calculate_total_and_commit fx_override fx_override_rate fx_override_nozero translate_profit_and_commit carryforward_and_commit derive_ytd pos next prior factor task</Keywords>
            <Keywords name="Words3"></Keywords>
            <Keywords name="Words4"></Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="2" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="FF0080" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
        </Styles>
    </UserLang>
    <UserLang name="MDX" ext="mdx">
        <Settings>
            <Global caseIgnored="yes" />
            <TreatAsSymbol comment="no" commentLine="no" />
            <Prefix words1="yes" words2="yes" words3="yes" words4="yes" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters">[&apos;0]&apos;0</Keywords>
            <Keywords name="Folder+">SELECT</Keywords>
            <Keywords name="Folder-">FROM</Keywords>
            <Keywords name="Operators">- ( ) * , . / : ; { | } + &lt; = &gt;</Keywords>
            <Keywords name="Comment">1/* 2*/ 0// 0--</Keywords>
            <Keywords name="Words1">WHERE COLUMNS ROWS NON EMPTY AS ON CALCULATE CASE EXISTING FREEZE IF SCOPE ALTER CUBE CREATE ACTION CELL CALCULATION GLOBAL WITH MEMBER SESSION SET SUBCUBE DROP SUBCUBE REFRESH CALL CLEAR CALCULATIONS DRILLTHROUGH UPDATE SetToArray This Leaves Current Item Root StrToTuple Error Hierarchy Dimension Dimensions Level Levels IsAncestor IsEmpty IsGeneration IsLeaf IsSibling CalculationPassValue CoalesceEmpty Generate IIf LookupCube MemberToStr Name Properties SetToStr TupleToStr UniqueName UserName</Keywords>
            <Keywords name="Words2">Aggregate Avg CalculationCurrentPass CalculationPassValue CoalesceEmpty Correlation Count Covariance CovarianceN DistinctCount IIf LinRegIntercept LinRegPoint LinRegR2 LinRegSlope LookupCube Max Median Min Ordinal Predict Rank RollupChildren Stddev StddevP StrToValue Sum Value Var Variance VarianceP VarP		</Keywords>
            <Keywords name="Words3">AllCalculatedMembers AllMembers Ancestors Ascendants Axis BottomCount BottomPercent BottomSum Children Crossjoin CurrentOrdinal Descendants Distinct DrilldownLevel DrilldownLevelBottom DrilldownLevelTop DrilldownMember DrilldownMemberBottom DrilldownMemberTop DrillupLevel DrillupMember Except Exists Extract Filter Generate Head Hierarchize Intersect LastPeriods Members Mtd NameToSet NonEmptyCrossjoin Order PeriodsToDate Qtd Siblings StripCalculatedMembers StrToSet Subset Tail ToggleDrillState TopCount TopPercent TopSum Union Unorder VisualTotals Wtd Ytd</Keywords>
            <Keywords name="Words4">Ancestor ClosingPeriod Cousin CurrentMember DataMember DefaultMember FirstChild FirstSibling Item Lag LastChild LastSibling Lead LinkMember NextMember OpeningPeriod ParallelPeriod Parent PrevMember StrToMember UnknownMember ValidMeasure</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="8080C0" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="00FF00" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="800040" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="800040" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="800040" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="6C6C6C" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
        </Styles>
    </UserLang>
</NotepadPlus>
To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Nick Warren

    Hi Madis,

    Thanks very much for this.

    On XP, my folder location is C:\Documents and Settings\USERNAME\Application Data\Notepad++ (Yes, I’m still using XP)

    Just another thing. I moved your *begin and *end to the end of the lines for Folder+ and Folder-, else ‘*end’ seems to resolve before a ‘*endwhen’, for instance, and only the ‘*end’ part highlights red and not then ‘when’ part.

    Thanks again

    Nick

    (0) 

Leave a Reply