[英]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.