Using Pagination to Return Certain Amounts of Data

Using Pagination to Return Certain Amounts of Data

Comments

  • I am creating a flow to allow other systems to retrieve data from Decisions. To avoid a large data transfer, I plan to implement the Pagination feature based on last ID of a previous call. The other system will invoke my flow with the last ID of the previous call then my flow will retrieve 500 records starting from the last ID. Is there any way to implement this?

  • The best course of action here would be to use a Raw SQL step to call the records. You can use the SQL Query below to do this:

    select entity_name as name, full_path, * from entity_folder
    order by entity_name desc
    offset @offset rows fetch next 10 rows only

    First, create a SQL Query step by navigating to a Designer folder > Create Datastructures/Integreations > Database Integration > Add Query
    [color=rgb(127, 140, 141)][font=Roboto][img]att1[/img][/font][/color]

    From here choose the database you would like to run the query on, and click Next.
    [color=rgb(127, 140, 141)][font=Roboto][img]att12/img][/font][/color]

    Name your query, then add the SQL steps above. You will see the @offset option appear in the input parameters. Click the pencil icon beside the @offset within the field.

    [color=rgb(127, 140, 141)][font=Roboto][img]att3[/img][/font][/color]

    Add a Default Value of 0 and set the type to int32.
    [color=rgb(127, 140, 141)][font=Roboto][img]att4[/img][/font][/color]

    Click Ok and then navigate to the flow designer

    Create a flow and add a For Loop step with your interaction. Then attach this to a Multiply step. In my example, since I want 100 records, I will set my iteration to 10 and multiply it by 10. This way my flow will loop 10 times, and pull 10 records for each loop.
    [color=rgb(127, 140, 141)][font=Roboto][img]att5[/img][/font][/color]

    Navigate to the Steps tab and navigate to Integration > Database > Your Database > The Exec step for the query you created. Attach this to the multiply step, and then to the end step. The screenshots below show exactly how this should look:
    [color=rgb(127, 140, 141)][font=Roboto][img]att6[/img][/font][/color]
    [color=rgb(127, 140, 141)][font=Roboto][img]att7[/img][/font][/color]

    This flow should help you reach the end goal youre looking to reach.

Sign In or Register to comment.