--- title: "How do I use parameters in a query?" slug: "how-do-i-use-parameters-in-a-query" updated: 2026-11-24T13:59:14Z published: 2026-11-24T13:59:14Z canonical: "support.lusid.com/how-do-i-use-parameters-in-a-query" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.lusid.com/llms.txt > Use this file to discover all available pages before exploring further. # How do I use parameters in a query? A parameter turns one query into many. Instead of editing a portfolio code or a date every time you run a query, mark it as a parameter, and the Luminesce Query Editor asks for the value each time you run it, with a date picker, a list to choose from, or a box to type in. Save the query, and everyone you share it with gets the same prompt. ## Prerequisites - Access to the Luminesce Query Editor in the LUSID web app, under **Data Virtualisation > Query Editor**. ## Methods ### Method 1: Add a parameter and run the query 1. In your query, replace a value with `:<name>:<default>`. Put the name in square brackets if it has spaces in it. The default value sets the parameter's type, so `#2024-01-01#` makes it a date and `1000` makes it a number. 2. Run the query. 3. In the **Parameters** dialog, check or change each value, then select **Run**. For example, this query asks for a portfolio scope, a date and a minimum amount: ```sql select TxnId, PortfolioCode, TransactionDate, TotalConsideration from Lusid.Portfolio.Txn where PortfolioScope = :[Portfolio scope]:'Finbourne-Examples'  and TransactionDate > :After:#2024-01-01#  and TotalConsideration > :[More than]:1000 ``` The dialog lists each parameter with its **Name**, **Data Type** and **Value**, and gives you the right control for each type, such as a date picker for a date. ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image-MH3K2M5O.png?sv=2026-02-06&spr=https&st=2026-11-24T14%3A55%3A09Z&se=2026-11-24T15%3A55%3A09Z&sr=b&sp=r&sig=rZ3Lu4uMrC4YHWsw%2FaujJYb29Hi%2BH1mSFozAbACR5%2Bk%3D) Select **Cancel** to go back to the editor without running the query. ### Method 2: Offer a list of values To let people pick a value rather than type one, list the values in curly brackets. The first is the default: ```sql select TxnId, PortfolioCode, TradeCurrency, TotalConsideration from Lusid.Portfolio.Txn where PortfolioScope = 'Finbourne-Examples'  and PortfolioCode = :[Choose fund]:{'UK-Equities', 'US-Equities'}  and TradeCurrency = :[Trade currency]:{'GBP', 'USD', 'EUR' *} ``` - Without a `*`, the value must be one from the list, as for `Choose fund`. - With a `*` before the closing bracket, people can pick from the list or type their own value, as for `Trade currency`. The list can also come from a query, so it's always up to date. Put the query in round brackets inside the curly ones: ```sql select PortfolioCode, DisplayName, BaseCurrency from Lusid.Portfolio where PortfolioScope = :[Portfolio scope]:{(select distinct PortfolioScope from Lusid.Portfolio order by 1) *} ``` For every form a parameter can take, including a type with no default, see [Understanding the Luminesce SQL query syntax](/v1/docs/understanding-the-luminesce-sql-query-syntax#parameterised-queries). ### Method 3: Use parameters in query sets, saved queries and history - **Query sets**: when you run a query set, the dialog asks for every parameter in every query in the set at once. A parameter with the same name in several queries is asked for once, and every query gets the same value. The dialog starts with the values you used last time. See [How do I run several queries together as a query set?](/v1/docs/how-do-i-run-several-queries-together-as-a-query-set) - **Saved queries**: when you open a saved query from the **Saved Queries** page, its parameters appear above the results, so you can change a value and run it again. See [How do I save, open and share queries?](/v1/docs/how-do-i-save-open-and-share-queries) - **History**: re-running a past query that has parameters asks for their values again. See [How do I find and re-run a past query?](/v1/docs/how-do-i-find-and-re-run-a-past-query-in-the-query-editor) A tool that doesn't ask for parameter values runs the query with the defaults. ## Troubleshooting ### Value must be one of the suggested options The parameter only accepts a value from its list. Pick one from the list, or, if any value should be allowed, add `*` before the closing curly bracket in the query. ### Error rendering query The query that builds the parameter's list failed, and the message says why. You can still type a value. To fix the list, run the query in the round brackets on its own and correct it. ### The dialog doesn't appear Check the parameter's colons: it needs one before the name and one after it, as in `:After:#2024-01-01#`. A name with spaces needs square brackets, as in `:[More than]:1000`. ## Related articles - [Understanding the Luminesce SQL query syntax: parameterised queries](/v1/docs/understanding-the-luminesce-sql-query-syntax#parameterised-queries) - [How do I run a query and follow its progress?](/v1/docs/how-do-i-run-a-query-and-follow-its-progress)