Creating a Snippet File
Adding a new reusable code snippet for the expression editor.
Implementation:
- Open the Expression Editor.
- Navigate to Tools > IntelliSense > Expression Snippets Manager.
- Click New to open an XML editor window containing a standard snippet based on your local snippet template.
- Edit the snippet as required by adding text to the relevant elements. In a given snippet, the XML elements you are most likely to change are as follows:
Element | Purpose | Example |
---|---|---|
Title | A short description of what the snippet does. This appears in the snippet picker when it is used in the Expression Editor. | "Create a DateDiff Expression." |
Shortcut | A short piece of text that, when typed into an expression followed by the Tab key, will automatically replace that text with the contents of the snippet. | "ddif" |
Description | A longer description of the snippet, which will appear when viewing the snippet in the Expression Snippets Manager. | "Creates a complete DateDiff Expression, including dates." |
Author | Shows the name of the person or organisation that created the snippet, when viewing the snippet in the Expression Snippets Manager. | "Mercato Solutions" |
Code | Contains the body of the expression you want to insert when invoking the snippet. | "DateDiff(date1, date2, returntype);" |
- When you have finished updating the snippet file, click Save and Close.
- Choose a location to save the snippet file and click Save.