[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-25。"],[],[],null,["# Use parameters in a custom query\n\nParameters let you build more responsive, customizable reports. You can pass parameters in a data source back to the underlying query. To use a parameter in your custom query, follow the relevant syntax guidelines documented in [Running parameterized queries](/bigquery/docs/parameterized-queries)\n\nStandard parameters\n-------------------\n\nYou can use the following parameters in any custom query:\n\nTo use these parameters, follow these steps:\n\n1. Below the query editor, turn on the parameters you want to use.\n\n | **Note:** You will be prompted to grant access to your email address when you turn on the @DS_USER_EMAIL parameter.\n2. In your query, be sure to use uppercase for the parameter names.\n\nAll parameter values are passed as strings. To handle them as dates, numbers, or other data types, be sure to use an appropriate conversion function, such as PARSE_DATE, PARSE_TIMESTAMP, or CAST.\n\n### Use date parameters to pass date ranges to the underlying query\n\nIf your report includes a [date range control](/looker/docs/studio/date-range-control), viewers can use that to request different starting and ending dates from the data.\n\n### Use the email parameter to provide row-level access to the data\n\nThe email parameter lets you show only the data associated with the logged-in user of a report, data source, or exploration. That user must be logged in to a Google Account and must consent to providing their email address to Looker Studio. If the viewer doesn't consent, all charts in the report based on this data source will display an authorization error.\n\nCustom parameters\n-----------------\n\nYou can use any parameters you create in the Looker Studio user interface in your custom query.\n\n### Create a parameter in the connection page\n\n1. Below the custom query editor, click **+ADD PARAMETER**.\n2. Configure the [parameter options](/looker/docs/studio/parameters).\n3. Click **OK**.\n\n### Hide custom parameters in the data source\n\nBy default, custom parameters can be modified in reports. To prevent report editors from changing a parameter's value, you can hide the parameter.\n\n1. To the right of the parameter, click **More options** .\n2. Click **Hide**.\n\nLearn more about [allowing data source parameters in reports](/looker/docs/studio/parameters).\n\nUse a parameter in a custom query\n---------------------------------\n\nIn the body of your custom query, replace a hard-coded value with an identifier beginning with the @ character. For example: @param_name.\n\nParameter examples\n------------------\n\nCustom parameter example: \n\n SELECT word FROM `TABLE` WHERE corpus = @corpus;\n\nUse a string with contains and a number: \n\n SELECT * FROM `bigquery-public-data.baseball.games_post_wide`\n WHERE REGEXP_CONTAINS(gameId, @s)\n AND attendance \u003e @attendance LIMIT 100;\n\nUse a multi-select string parameter. Note the use of UNNEST to flatten the list of values: \n\n SELECT * from user.users as user WHERE display_name in UNNEST(@name);\n\nDate parameter example (date is in standard format): \n\n SELECT creation_date, age, display_name from user.users as user\n WHERE creation_date \u003e PARSE_DATE('%Y%m%d', @DS_START_DATE)\n AND creation_date \u003c PARSE_DATE('%Y%m%d', @DS_END_DATE);\n\nDate parameter example (date is a Unix timestamp in microseconds): \n\n SELECT creation_date, age, display_name from user.users as use\n WHERE creation_date \u003e UNIX_MICROS(PARSE_TIMESTAMP('%Y%m%d', @DS_START_DATE)\n AND creation_date \u003c UNIX_MICROS(PARSE_TIMESTAMP('%Y%m%d', @DS_END_DATE)\n\nEmail parameter example: \n\n SELECT * FROM Sales WHERE sales-rep-email = @DS_USER_EMAIL;\n\nRelated resources\n-----------------\n\n- [About parameters](/looker/docs/studio/parameters)"]]