<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Paginate Records in a Table in Workflows (Recursion Example)
Okta Classic Engine
Okta Identity Engine
Workflows

OVERVIEW

This guide will teach you how to paginate a table with more than 3,500 records in Okta Workflows.

 

SOLUTION

The Tables—Search Rows card returns 3,500 rows (records) from a table. If a table has more than 3,500 records, you must paginate the result to retrieve all the records.

The solution has two flows:

  • Main.
  • Paginate table.


Table

 

This example uses the Countries table with 249 countries and a page size of 50.


Country table.


Main flow

 

The Main flow starts the pagination. The flow has two inputs:

  • Limit: How many records are to be returned (per page).
  • Offset: at which record should the search start.

 


Main flow to start pagination.

  1. The Call Flow card starts the pagination. It requests the first 50 records from a table.
    • After paginating through all the table records, the Result field holds all the records from the table.
  2. The List—Length card shows the number of records in the list (which also shows the number of records in a table).


Paginate table flow

 

The Paginate table flow retrieves 50 records until there are no more records in the table.

 


Paginate table flow
.

  1. The Helper Flow card starts this flow.
  2. The Tables—Search Rows card retrieves table records using the Limit and Offset fields.
  3. The List-Length card calculates the list size from the previous stop.
  4. The Branching—If/Else card
    • If Row count < Limit (if there are less than 50 records), these are the last records and nothing else to retrieve after this stop.
    • Else (there are more than 50 records)
      • The Number—Add card calculates the next Offset. It adds 50 to the current Offset.
      • The flow recursively calls the Call Flow card, passing the new Offset value.
      • The List—Combine All card combines the records from current and child results.
  5. The Flow Control—Return card returns all the records to the Main flow.


The following shows the recursive calls and how the calls return data.

 

  • Execution 1 starts with Offset=0
  • Execution 1 does a query, gets rows 1-50
  • Execution 1 does a recursive Call Flow
    • Execution 2 starts with Offset=50
    • Execution 2 does a query, get rows 51-100
    • Exec2 does a recursive Call Flow
      • Execution 3 starts with Offset=100
      • Execution 3 does a query, gets rows 101-150
      • Execution 3 does a recursive Call Flow
        • Execution 4 starts with Offset=150
        • Execution 4 does a query, gets rows 151-200
        • Execution 4 does a recursive Call Flow
          • Execution 5 starts with Offset=200
          • Execution 5 does a query, gets rows 201-249
          • Execution 5 sees there are no more records and returns an array with rows 201-249
        • Execution 4 combines its results with the child's results
        • Execution 4 returns an array with rows 151-249
      • Execution 3 combines its results with the child's results
      • Execution 3 returns an array with rows 100-249
    • Execution 2 combines its results with the child's results
    • Execution 2 returns an array with rows 50-249
  • Execution 1 combines its results with the child's results
  • Execution 1 returns an array with rows 1-249


Template

 

Download a flow template. 

 

RELATED REFERENCES

 

 

Loading
Paginate Records in a Table in Workflows (Recursion Example)