在 Azure 逻辑应用中使用分页获取更多数据、项或记录Get more data, items, or records by using pagination in Azure Logic Apps

Azure 逻辑应用中使用连接器操作检索数据、项或记录时,获取的结果集可能太大,以致操作无法一次性返回所有结果。When you retrieve data, items, or records by using a connector action in Azure Logic Apps, you might get result sets so large that the action doesn't return all the results at the same time. 某些操作的结果数可能会超过连接器的默认页面大小。With some actions, the number of results might exceed the connector's default page size. 在这种情况下,操作仅会返回结果的第一页。In this case, the action returns only the first page of results. 例如,SQL Server 连接器的“获取行”操作的默认页面大小为 2048,但是可能因其他设置而有所不同 。For example, the default page size for the SQL Server connector's Get rows action is 2048, but might vary based on other settings.

某些操作允许启用分页设置,使逻辑应用能够检索更多的结果(不能超过分页限制),但在操作完成时会以单个消息的形式返回这些结果。 Some actions let you turn on a pagination setting so that your logic app can retrieve more results up to the pagination limit, but return those results as a single message when the action finishes. 使用分页时,必须指定阈值,即要让操作返回的目标结果数。 When you use pagination, you must specify a threshold value, which is the target number of results you want the action to return. 在达到指定的阈值之前,操作会不断地检索结果。The action retrieves results until reaching your specified threshold. 如果总项数小于指定的阈值,操作将检索所有结果。When your total number of items is less than the specified threshold, the action retrieves all the results.

启用分页设置会根据连接器的页面大小检索结果页面。Turning on the pagination setting retrieves pages of results based on a connector's page size. 此行为意味着,获取的结果数有时会超过指定的阈值。This behavior means that sometimes, you might get more results than your specified threshold. 例如,使用 SQL Server 的支持分页设置的“获取行”操作时: For example, when using the SQL Server Get rows action, which supports pagination setting:

  • 该操作的默认页面大小为每页 2048 条记录。The action's default page size is 2048 records per page.
  • 假设你有 10,000 条记录,并指定 5000 条记录作为最小值。Suppose you have 10,000 records and specify 5000 records as the minimum.
  • 分页功能将获取记录页面,因此,若要至少获取指定的最小数目,操作将返回 6144 条记录(3 个页面 x 2048 条记录),而不是 5000 条记录。Pagination gets pages of records, so to get at least the specified minimum, the action returns 6144 records (3 pages x 2048 records), not 5000 records.

下面仅仅列出了其特定操作可能会超出默认页面大小的一部分连接器:Here's a list with just some of the connectors where you can exceed the default page size for specific actions:

先决条件Prerequisites

启用分页Turn on pagination

若要确定某个操作是否支持逻辑应用设计器中的分页,请在“分页”设置中检查该操作的设置。 To determine whether an action supports pagination in the Logic App Designer, check the action's settings for the Pagination setting. 此示例演示如何在 SQL Server 的“获取行”操作中启用分页。 This example shows how to turn on pagination in the SQL Server's Get rows action.

  1. 在该操作的右上角选择省略号 ( ... ) 按钮,然后选择“设置”。 In the action's upper-right corner, choose the ellipses (...) button, and select Settings.

    打开操作的设置

    如果该操作支持分页,它会显示“分页”设置。 If the action supports pagination, the action shows the Pagination setting.

  2. 将“分页”设置从“关”更改为“开”。 Change the Pagination setting from Off to On. 在“阈值”属性中,指定一个整数值,作为操作要返回的目标结果数。 In the Threshold property, specify an integer value for the target number of results that you want the action to return.

    指定要返回的最小结果数

  3. 准备就绪后,选择“完成” 。When you're ready, choose Done.

工作流定义 - 分页Workflow definition - pagination

针对支持分页功能的操作启用分页时,逻辑应用的工作流定义会在该操作的 "runtimeConfiguration" 属性中包含 "paginationPolicy" 属性以及 "minimumItemCount" 属性,例如:When you turn on pagination for an action that supports this capability, your logic app's workflow definition includes the "paginationPolicy" property along with the "minimumItemCount" property in that action's "runtimeConfiguration" property, for example:

"actions": {
   "HTTP": {
      "inputs": {
         "method": "GET",
         "uri": "https://www.testuri.com"
      },
      "runAfter": {},
      "runtimeConfiguration": {
         "paginationPolicy": {
            "minimumItemCount": 1000
         }
      },
      "type": "Http"
   }
},

获取支持Get support

有关问题,请访问 Azure 逻辑应用论坛For questions, visit the Azure Logic Apps forum.