TM1 and Notepad++
- Mar. 28, 2017
In TM1 we regularly write logic for business rules and business processes. The editors we have (Rules Editor and Turbo Integrator) are not modern user interfaces. They have not been changed since ages (except maybe the "Advanced Rules Editor" but also that was not the best piece of software). Yes, there is Performance Modeler. But still we tend to prefer Architect and coding the old-fashioned way. In conjunction with a text editor like Notepad++ this seems to be the most efficient for TM1 Developers and Admin persons.
Below I will show you what I use the most in Notepad++ to help my daily work in TM1.
Shortcut keys that I found very useful:
- Ctrl-d: duplicate the current line as a new line below the current line
- Ctrl-l: cut the contents of the current line
- Ctrl-Shift-l: delete the current line. Note: With macro commands in Notepad++, we can swap the commands for cutting the line contents and deleting an
entire line. Refer to https://stackoverflow.com/questions/5031741/delete-line-without-adding-to-clipboard
The quick tutorial is to go to 'Macro - Modify Shortcut/Delete Macro' > 'Scintilla commands' and you swap the commands on line 89 and 90 (SCI_LINECUT and SCI_LINEDELETE).
- Ctrl-m: insert a new line and start on the left, rather than indented. Watch out ! This inserts a CR (Carriage Return) character in Notepad++ rather instead of a CRLF (Carriage Return LineFeed) character. Pasting this in TM1 gives problems since CRLF is recognized but not CR.
- Ctrl-z: undo
- Ctrl-t: swap the line with the line above
- Ctrl-Shift-Arrow up or down: move the selected line(s) up or down
- Ctrl-t: swap the current line and the line immediately above
- Ctrl-Arrow up or down: scroll the document but the cursor remains fixed
- Ctrl-k: comment the selection if you use the TM1 language add-on (in general, comment text following the language chosen)
- Ctrl-Shift-k: uncomment the selection if you use the TM1 language add-on (in general, uncomment text following the language chosen)
- Use bookmarks (Ctrl-F2) in your files, such that F2 allows you to quickly jump to the next one and Shift-F2 to the previous one
- Ctrl-Shift-f: do a Find command in all files of a chosen folder, with options
- Ctrl-F3: select a certain piece of text and this command brings you to the next instance of that text in the same file (Ctrl-Shift-F3 for the previous occurrence of the same text)
- Ctrl-Num +, Ctrl-Num -, Ctrl-Num /: zoom in, zoom out, restore the zoom. Handy when giving a course on TI. (As is possible in other software too, Ctrl-scrollwheel has the same effect)
- Tab-Tab in a TI process: highlights all code in the tab (including generated statements though), Ctrl-A will not work
The menu option Edit > Blank Operations allows to convert tabs to spaces and to do similar operations.
You can find a certain text string in all *.pro or *.rux files of a folder. Regular expression searching is supported.
In its multi-tab interface, you are able to clone a window or move a window to another view in the same Notepad++ window. Comparing files and code becomes a breeze. Talking about comparing code, you will want to use the plugin "Compare". With 2 files opened, hitting Alt-D instantly compares the 2 files.
Another useful plugin is "Save as admin", whereby you can save files that would otherwise not be possible without elevated rights.
Rectangular (columnar) selections are possible. This means that you can delete a "column" in a *.txt text file, for example. Or add a string to 20 similar rules statements in one go. For a rectangular selection keep Alt pressed, and make the selection.
You can also set in the Notepad++ settings that creating a selection with Ctrl-click functionality, allows you to take action on any of the selected areas. For example, you copy a piece of text, Ctrl-click 10 different areas, paste, and the 10 areas will be updated all at once !
Frequently used words can be completed automatically like a kind of Intellisense. This saves time when using TI statements like DimensionElementInsert or DimensionElementComponentAdd. Do note that this autocompletion feature can be case-sensitive.
Coloring function names and other codes is a helpful when developing code. See: this link on the TM1forum. You can extend the XML file if you want. One of the small additions is that files with extension *.pro or *.rux can be opened up in Notepad++ automatically with the TM1 language turned on.
Lines of code can be hidden, folded/unfolded, and several levels in the same document can be defined. Next to that, you can copy code as html to the clipboard, giving you coloured lines of code that are easier to read and understand.
It is possible to save a set of files (like 5 processes or some rux files) and reopen that session later on again. I use it to have a session with a tm1s.cfg file, tm1p.ini file, the tm1s-log.properties file and a couple of other useful text files. This saves time, definitely.
Notepad++ has its own macro recorder but I did not do a lot with it yet. Likewise, it is possible to have projects in Notepad++, each with their own files, and they can be managed from within Notepad++. Again, that is something to explore and see how useful and timesaving it is.