To view this documentation for the Periscope Classic UI, click here.
Parameterized snippets allow you to pass values directly into your snippets. They also help to make your queries more dynamic, and provide a way to imitate passing variables into a function.
Let's start by creating a snippet for calculating percentage change. Specify the parameters used in the name of the snippet. Rounded parentheses are used to indicate the start and end of the parameter list and commas to separate the passed in paramaters. For this example, the name of the column of the current value as well as the column with the previous value are being passed in.
Now that the parameters have been defined in the name, they can be used in the snippet code by wrapping them in square brackets:
To use a snippet in a query, call its name with square parentheses, and pass in actual columns or values as the parameters:
The generated code and how the snippet and parameters get substitued can be seen by clicking on our SQL tab.
If parameters have commas, wrap them in double quotes "," to make sure they are passed in correctly.