日期范围控件
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如果您使用的数据源在提取数据时需要日期范围,则可以利用 Looker Studio 日期范围功能。
若要为您的社区连接器启用日期范围控制功能,请在 getConfig
响应中将 dateRangeRequired
设置为 true
。然后,Looker Studio 会在向您的连接器发出的每个 getData
请求中添加开始日期和结束日期。
dateRangeRequired
为 true
时的 getData
行为
在 getConfig
响应中将 dateRangeRequired
设置为 true
时,每个 getData
请求都会包含一个带有 startDate
和 endDate
参数的 dateRange
对象。日期参数将采用 YYYY-MM-DD
格式。您可以在向第三方服务发送的数据提取请求中使用这些值。
- 默认情况下,提供的日期范围将是过去 28 天(不包括今天)。
- 如果用户为报告应用日期范围过滤器,则提供的日期范围将反映用户的选择。
- 当 Looker Studio 尝试检测语义类型时,
getData
请求中的 sampleExtraction
会设置为 true
。对于此类请求,针对开始日期和结束日期提供的日期会比今天早两天。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eWhen fetching data requiring a date range, leverage Looker Studio's date range features by setting \u003ccode\u003edateRangeRequired\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e in your connector's \u003ccode\u003egetConfig\u003c/code\u003e response.\u003c/p\u003e\n"],["\u003cp\u003eThis enables Looker Studio to include start and end dates with every \u003ccode\u003egetData\u003c/code\u003e request, allowing you to filter data from external sources.\u003c/p\u003e\n"],["\u003cp\u003eThe default date range is the last 28 days excluding today, but users can apply custom ranges, and semantic type detection uses a two-day offset.\u003c/p\u003e\n"]]],[],null,["# Date range control\n\nIf you are working with a data source that requires a date range when fetching\ndata, you can take advantage of the [Looker Studio date range features](https://support.google.com/looker-studio/answer/6291067).\n\nTo enable the date range control feature for your Community Connector, set\n`dateRangeRequired` to `true` in your\n[`getConfig`](/looker-studio/connector/reference#getconfig) response. Then,\nLooker Studio will include a start and end date with every\n[`getData`](/looker-studio/connector/reference#getdata) request made to your\nconnector.\n\n`getData` behavior when `dateRangeRequired` is `true`\n-----------------------------------------------------\n\nWhen `dateRangeRequired` is set to `true` in your `getConfig` response, each\n[`getData`](/looker-studio/connector/reference#getdata) request will contain a\n`dateRange` object with `startDate` and `endDate` parameters. The date\nparameters will be in `YYYY-MM-DD` format. You can use these values in data\nfetch requests to third-party services.\n\n- By default, the date range provided will be the last 28 days, excluding today.\n- If a user applies a date range filter for a report then the date range provided will reflect the user selection.\n- When Looker Studio is attempting to detect [semantic types](/looker-studio/connector/semantics), [`sampleExtraction`](/looker-studio/connector/reference#request_3) is set to `true` in `getData` requests. For these requests, the date provided for the start and the end date is two days earlier than today."]]