--- title: "How do I turn a query into a view with the view designer?" slug: "how-do-i-turn-a-query-into-a-view-with-the-view-designer" updated: 2026-11-24T13:59:14Z published: 2026-11-24T13:59:14Z canonical: "support.lusid.com/how-do-i-turn-a-query-into-a-view-with-the-view-designer" --- > ## 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 turn a query into a view with the view designer? A query you've perfected is worth sharing. Turn it into a custom view and it appears in the Catalogue as a provider of its own, so your team can query it by name, with parameters, without seeing or copying the SQL behind it. The view designer in the Luminesce Query Editor writes the `Sys.Admin.SetupView` query that publishes it. ## Prerequisites - Access to the Luminesce Query Editor in the LUSID web app, under **Data Virtualisation > Query Editor**. - Permission to use `Sys.Admin.SetupView`, and a licence for it. See [Query Editor permissions reference](/v1/docs/query-editor-permissions-reference). - A query that returns the data the view should return. ## Methods ### Method 1: Create a view 1. Put the query in the editor. To use only part of what's in the tab, highlight that part. 2. Select the view designer on the toolbar: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(980).png?sv=2026-02-06&spr=https&st=2026-11-24T15%3A02%3A48Z&se=2026-11-24T16%3A02%3A48Z&sr=b&sp=r&sig=tYnfZiL1oGk89r3QiGpHphqixhJC%2BIjuIUEoEVlUn4A%3D) You can also select **View Designer** in the query designer. 3. Complete the form: - **View Name**: the name the view has in the Catalogue, such as `Views.Finance.MaturingBonds`. It must be unique. - **Optional Description**: shown in the Catalogue, so people know what the view returns. - **Documentation Link / Url**: an optional link to more information about the view. 4. Add any parameters the view needs (Method 2). 5. Check the query at the bottom of the form, then select **Generate SQL**. 6. The view designer replaces everything in the tab with the SQL that creates the view. Read the comment at the end, add the macros it suggests (Method 3), then run the query to publish the view. 7. Select **Refresh** in the Catalogue to see your view. For example, to create the [Views.MaturityDaysToExpiry example view](/v1/docs/creating-custom-views-sysadminsetupview#example-creating-a-viewsmaturitydaystoexpiry-view), you could complete the form like this: ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(979).png?sv=2026-02-06&spr=https&st=2026-11-24T15%3A02%3A48Z&se=2026-11-24T16%3A02%3A48Z&sr=b&sp=r&sig=gWUyYTybhvP5eQd7qJQIefD9qpo1wbNDRcVDla6JoDY%3D) If a view with that name already exists, you're asked whether to carry on. Carrying on replaces it when you run the query. ### Method 2: Add parameters Parameters let the people using your view pass values in, such as a portfolio scope or a date. 1. Select **Create Parameter**. 2. Enter a **Parameter name**, choose a **Data type**, and enter an **Initial value**: the value used while you set the view up. 3. Turn on **Is initial value default** to use the initial value whenever someone queries the view without giving one. Leave it off to use it only while setting the view up. 4. Optionally, enter a **Description**. It's shown beside the parameter in the Catalogue. For a **Table** parameter, enter the name of a table variable in your query as the **Initial value**, such as `@portfolios`. Turn on **Pass in table of data** to require people to pass a table in. The parameters table shows each one; right-click a row to edit or delete it. The **Is Mandatory** column shows the setting of **Is initial value default** or **Pass in table of data**. Adding a parameter declares it, but doesn't use it. To use its value in the view, put `#PARAMETERVALUE(<name>)` in the view's SQL after you generate it, for example `where PortfolioScope = #PARAMETERVALUE(Scope)`. The generated comment shows an example for each parameter. ### Method 3: Make the view fast The view designer wraps your query as it is. For the view to perform well, especially on large providers, add the macros that pass the user's filters, columns and limits through to the providers underneath: - `#SELECT_AGG` (or `#SELECT`) and `#RESTRICT_AGG` (or `#RESTRICT`) around the columns - `#GROUP_BY`, `#ORDER_BY`, `#DISTINCT` and `#LIMIT` The comment the designer adds lists them as a reminder. See [Writing a Sys.Admin.SetupView query to create your custom view](/v1/docs/creating-custom-views-sysadminsetupview#writing-a-sysadminsetupview-query-to-create-your-custom-view) for how to use each one. ### Method 4: Change an existing view Put the view's `use Sys.Admin.SetupView … enduse` query in the editor, for example by opening it from `Sys.File` or a Saved Query, then select the view designer. The form opens with the view's name, description, link and parameters filled in. Change them, generate the SQL and run it to publish the change. ## Troubleshooting ### The form says there was an issue in validating it If you're creating a new view from an ordinary query, ignore the message and carry on. If you're editing an existing view, the designer couldn't read its `use Sys.Admin.SetupView` query; select **here** in the message for the details. A common cause is a missing `----` line between the options and the SQL. ### Generate SQL is greyed out Enter a **View Name**. ### The view ignores a parameter Add `#PARAMETERVALUE(<name>)` where the value belongs in the view's SQL (Method 2). ## Related articles - [Creating custom views (Sys.Admin.SetupView)](/v1/docs/creating-custom-views-sysadminsetupview) - [How do I add links to a custom view?](/v1/docs/how-do-i-add-links-to-a-custom-view) - [How do I use the Luminesce query designer?](/v1/docs/how-do-i-use-the-luminesce-query-designer)