电源查询 |延迟循环
Power Query | Loop with delay
我是 PQ 的新手,正在尝试执行以下操作:
- 从服务器获取更新
- 改造它。
- Post数据返回。
虽然代码工作得很好,但我希望它每 N 分钟执行一次,直到应用程序关闭。
此外,每次调用 GetUpdates() 后都应重新评估 LastMessageId 变量,我需要以某种方式再次调用 GetUpdates()。
我试过 Function.InvokeAfter 但不止一次 运行 没搞懂。
递归 blow stack out ofc.
我看到的唯一解决方案是使用 List.Generate 但很难理解如何延迟使用它。
let
//Get list of records
GetUpdates = (optional offset as number) as list => 1,
Updates = GetUpdates(),
// Store last update_id
LastMessageId = List.Last(Updates)[update_id],
// Prepare and response
Process = (item as record) as record =>
// Map Process function to each item in the list of records
Map = List.Transform(Updates, each Process(_))
in
Map
PowerBI 不支持在桌面中连续自动重新加载数据。
在线,您可以使用直接查询强制刷新最快 15 分钟1
替代方法:
- 您可以在 Excel 中执行此操作并使用 VBA 按计划重新执行查询
- PowerBI 中的流式数据2
- 使用 Flow 和 PowerBI 流式传输数据3
1: Supported DirectQuery Sources
2: Realtime Streaming in PowerBI
4: 不要忘记启用历史记录!
我是 PQ 的新手,正在尝试执行以下操作:
- 从服务器获取更新
- 改造它。
- Post数据返回。
虽然代码工作得很好,但我希望它每 N 分钟执行一次,直到应用程序关闭。 此外,每次调用 GetUpdates() 后都应重新评估 LastMessageId 变量,我需要以某种方式再次调用 GetUpdates()。
我试过 Function.InvokeAfter 但不止一次 运行 没搞懂。 递归 blow stack out ofc.
我看到的唯一解决方案是使用 List.Generate 但很难理解如何延迟使用它。
let
//Get list of records
GetUpdates = (optional offset as number) as list => 1,
Updates = GetUpdates(),
// Store last update_id
LastMessageId = List.Last(Updates)[update_id],
// Prepare and response
Process = (item as record) as record =>
// Map Process function to each item in the list of records
Map = List.Transform(Updates, each Process(_))
in
Map
PowerBI 不支持在桌面中连续自动重新加载数据。
在线,您可以使用直接查询强制刷新最快 15 分钟1
替代方法:
- 您可以在 Excel 中执行此操作并使用 VBA 按计划重新执行查询
- PowerBI 中的流式数据2
- 使用 Flow 和 PowerBI 流式传输数据3
1: Supported DirectQuery Sources
2: Realtime Streaming in PowerBI
4: 不要忘记启用历史记录!