Create your own snippets

Arc helps you develop higher quality TM1/Planning Analytics applications faster. Arc is full of features which will save you lots of time, one of them is the snippets.

When you hit CTRL + Space in either a process or a rule, a dropdown appears which gives you access to:

  • All your variables defined in the TM1 process.
  • All your TM1 processes.
  • All TM1/Planning Analytics functions.
  • A lot of battle tested code (snippets).

The list is constantly updated. If you create a new TM1 process, it will appear in the dropdown list, in the example below we add the new process Cub.SalesbyStore.LoadFromFile:

How to create your own snippets

It is very easy to add your own snippets. Create a folder called snippets in the Arc folder and then create a file processes.json.

The snippets file needs to be in JSON format, the value is what you see in auto complete and snippet is the content inserted. The placeholders are used to update blocks of code, example: ${1:condition}. If you want the code to be updated in multiple locations use the same placeholder number.

In the example below we added two new snippets with the name starting with MY so it will be easier to find them, but you can call them as you wish:

      "value": "MYSNIPPET: If ELSEIf ELSE",
      "snippet": "IF(${1:condition});\n\t${2:consequent}\nELSEIf(${3:condition});\n\t${4:consequent}\nELSE;\n\t${5:alternative}\nENDIF;\n"
      "value": "MYSNIPPET: If...ELSE",
      "snippet": "IF(${1:condition});\n\t\nELSE;\n\t\nENDIF;\n"

Once the processes.json has been updated, save the file and then refresh your browser but do not forget to clear the cache. Now if you hit CTRL + SPACE in a process and type snippet, you should have access to your new snippets: