May 1, 2018

How to overwrite the snippets/functions

The following article will explain you how to customize the existing list of snippets. Instead of trying to customize the snippets, it is much easier to create your own.

To customize the snippets, you need to follow these steps:

  1. Get the snippets from Arc using Chrome.
  2. Create the new snippets files.
  3. Paste all snippets into these files.
  4. Overwrite the snippets.

1 – Get the list of snippets

The next step is to get the list of snippets and to paste it into our new files. To get the list of snippets, first open a TM1 process in Arc and then open the Developer toolbox of Chrome (F12) and follow these steps:

  1. Go to the Network folder which will show all the files loaded by Arc.
  2. You will need to filter the files with “snippets” if you want to get the snippets contents or “functions” if you are looking for TM1 functions.
  3. Click on processes or rules (if the files do not appear, refresh the browser)
  4. Go to the Response tab
  5. Copy the content

2 – Create the snippets file

The snippets are stored in four different files:

  • public/snippets/processes.json: list of snippets for processes.
  • public/snippets/rules.json: list of snippets for rules.
  • public/functions/processes.json: list of TM1 functions for processes.
  • public/functions/rules.json: list of TM1 functions for rules.

To overwrite the snippets, you will need to create these files in your Arc folder

WARNING: Once these files are in your Arc folder, Arc will start using these files instead of the internal files. It means that if one of these files is blank, you won’t be able to see the corresponding snippets in Arc. That is why you should first get the content using Chrome, create the files, paste the content in these files and finally overwrite these files.

You don’t have to create the four files, if you just want to overwritte the snippets for the TM1 processes, you should just create public/snippets/processes.json file.

3 – Paste the content into the file

Paste the content in the relevant file, in our example we paste the content in public/snippets/processes.json

The content is in a JSON format, you can ask Notepad++ to format this file if you have the right plugins installed:

4 – Overwrite the file

Now you start overwritting this file. If you are planning to replace the lowercase into uppercase, replacing the all file will not work, you will have to replace only the specific word one by one because few key words have to stay lower case:

Related content

Loading related content