Optimizing parameters improves the speed, performance and user experience. Below are some tips to keep parameters as performant and user-friendly as possible.
User-Friendly Display Name
Specify a mapping between a database value and a user-friendly name that is displayed to users in the display name field. In the example shown below, the parameter is uses an internal value of M01 to represent the month of January in their data. Rather than display M01 to a user, who may not know what that means, you can display that value as January.
Use Multiple Search Terms
One of the many benefits of parameters is the ability to specify multiple search terms for the values in your data. For example, CRM data often stores names as first_name, last_name and full_name. By including last name and full name in the parameter SQL query, users would be able to search by full name or last name and get parameter matches returned for their search.
Example: Using Full Name Only
With the SQL shown in this example, if a user were to start typing a player's last name, they would not see any suggested parameters for this player in the search results.
Example: Using Full Name and Last Name
With the SQL shown in this example, if a user were to start typing a player's last name, they would see parameter suggestions that match who they are searching for.
Calculate Parameter Size
The below is an example to calculate the number of players a user enters via a {players} parameter.
set @playersListLength = (select count(*) from player where player_id in ({players}));
having count(p.player_id) = @playersListLength
SQL Comment Format
Always use the format of /*.......*/ when writing comments in your SQL query. Other approaching to writing comments, such as double slashes (//) or dashes (--), can result in a SQL error.