简体   繁体   English

如何使用 Data Studio 中的 BigQuery 连接器向参数添加“允许值”列表?

[英]How to add a list of "permitted values" to a parameter by using a BigQuery connector in Data Studio?

I was wondering if there is a way to add a list of "permitted values" to a parameter in Data Studio by using a custom query / BigQuery connector?我想知道是否有办法通过使用自定义查询/BigQuery 连接器将“允许值”列表添加到 Data Studio 中的参数?

There is an option to do it manually in the Data Studio UI: Permitted values through Data Studio UI在 Data Studio UI 中有一个手动执行的选项: Permitted values through Data Studio UI

But I am looking for a solution to do it through SQL because I have to pass a long list of values that can be changed every day, so adding a list of values manually through the UI is impossible.但是我正在寻找通过 SQL 完成此操作的解决方案,因为我必须传递一长串每天都可以更改的值,因此不可能通过 UI 手动添加值列表。

Is it possible to do it through a custom query?是否可以通过自定义查询来完成?

Thank you!谢谢你!

You can add parameters to a custom SQL query in the connector, just like the following examples show您可以将参数添加到连接器中的自定义 SQL 查询,就像以下示例所示

    SELECT word FROM `TABLE` WHERE corpus = @corpus;
    
    Use a string with contains and a number:
    
    SELECT * FROM `bigquery-public-data.baseball.games_post_wide`
    
    WHERE REGEXP_CONTAINS(gameId, @s)
    
    AND attendance > @attendance LIMIT 100;

    
    Use a multi-select string parameter. Note the use of UNNEST to flatten the list of values:
    
    SELECT * from user.users as user WHERE display_name in UNNEST(@name);

    
    Date parameter example:
    
    SELECT creation_date, age, display_name from user.users as user
    
    WHERE creation_date > PARSE_DATE('%Y%m%d', @DS_START_DATE)
    
    AND creation_date < PARSE_DATE('%Y%m%d', @DS_END_DATE);

    
    Email parameter example:
    
    Select * from Sales WHERE sales-rep-email = @DS_USER_EMAIL;

Here you can read more about using parameters in Data Studio您可以在此处阅读有关在 Data Studio 中使用参数的更多信息

You do not need a custom query to define allowed Values if you want to Filter for them just set them up as a Dimension and add a Filter Control with an drop-down List.如果您想为它们过滤,则不需要自定义查询来定义允许的值,只需将它们设置为维度并添加带有下拉列表的过滤控件。 This will allow you to select the present Values and filter for them.这将允许您 select 当前值并过滤它们。

Let me know if this solves it for you如果这能为您解决问题,请告诉我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Google Data Studio 社区连接器与 BigQuery 结合使用时的时间戳查询问题 - Timestamp query issue when using Google Data Studio community connector with BigQuery 如何使用用户可以在 getFields 的计算字段中更新的参数(Data Studio 社区连接器) - How to use a parameter which a user can update in a calculated field in getFields (Data Studio Community Connector) Excel 的 BigQuery 连接器:参数类型不正确 - BigQuery Connector for Excel : Incorrect parameter type 使用 bigquery 和 data studio 进行动态查询 - Dynamic query using bigquery and data studio 使用 Spark BigQuery 连接器查询 BigQuery 视图时未启用缓存 - Cache not enabled when querying BigQuery view using Spark BigQuery connector 数据工作室如何从 Bigquery 制作普通表 - Data studio how to make a normal table from Bigquery Data Studio Community Connector:如何更改数据新鲜度间隔 - Data Studio Community Connector: How to change Data freshness interval 如何使用 BigQuery 过滤多个值 - How to filter multiple values using BigQuery 如何将 Data Studio 控件传递给 BigQuery 自定义查询 - How to pass Data Studio Controls to BigQuery custom query 如何使用 BigQuery 获取 GROUP BY 子句中的值数组? - How to get array of values in GROUP BY clause using BigQuery?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM