How to Iterate Over Rows in a Table in Okta Workflows
Tags: nocode, workflows, okta, ipaas
Published: 2022-09-16 22:48:46

---
title: How to Iterate Over Rows in a Table in Okta Workflows
published: true
date: 2022-09-13 23:48:57 UTC
tags: NoCode,Workflows,okta, ipaas
canonical_url: https://maxkatz.net/2022/09/13/how-to-iterate-over-rows-in-a-table-in-okta-workflows/
---

[Okta Workflows](https://www.okta.com/platform/workflows/) how-to guides are questions and answers from weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows), MacAdmins [Workflows Slack channel](https://www.macadmins.org/), and other places. 

Read all the other how-to guides ⤵️
{% embed https://dev.to/oktaworkflows/all-okta-workflows-how-to-guides-4nl9 %}

On to the question. 

**_How to iterate over rows in a table?_**

To iterate over rows in a table you need

1. Find the rows (usually done with search)
2. Pass each row to a helper flow to process

Let’s look at an example using a table with all the countries in the world:

[![Country table](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_table.png?w=1024)](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_table.png)
<figcaption>Country table</figcaption>

In the main flow, find the rows use the **[Tables – Search Rows](https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/Tables/stash_searchrows2.htm)** card (max. 3,500 rows will be returned). To return all the rows don’t enter a search expression. Then pass the rows to a **[List – For Each](https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/List/list_each.htm)** card where a helper flow will process each record at a time.

This is the main flow:

[![Search for rows](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_main3.png?w=881)](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_main3.png)
<figcaption>Search for rows</figcaption>

In the **[List – For Each](https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/List/list_each.htm)** card, set the helper flow ( **Helper Flow** input).

Then set the value to pass to the helper flow ( **Country row** input).

In this flow you are passing the entire row or object (named **item** ) to the helper flow.

You can also pass a particular property from the object (row). To learn how to do that read [How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)](https://dev.to/oktaworkflows/how-to-setup-a-workflows-helper-flow-with-for-each-and-streaming-cards-3k96).

This is the helper flow:

[![Helper flow to process a row from a table](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_helper.png?w=1024)](https://katzmax.files.wordpress.com/2022/09/workflows_howto_looptables_helper.png)
<figcaption>Helper flow to process a row from a table</figcaption>

A flow becomes a helper flow when the first card is **[On Demand – Helper Flow](https://help.okta.com/wf/en-us/Content/Topics/Workflows/learn/about-helper-flows.htm)**. This card has one input **Country row**. Its type is object because you are passing the entire object (row) to this flow.

You can use **[Object – Get Multiple](https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/Object/object_pick.htm)** card to read values from the object (row) passed to this flow. In this example you are reading the **Country** and its **Code**.

Learn more how to use **[Object – Get Multiple](https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/Object/object_pick.htm)** card: [How to Read a JSON Path With Dot-Notation in Workflows](https://dev.to/oktaworkflows/how-to-read-a-json-path-with-dot-notation-in-workflows-3dlk).

Result running the flow (helper flow shown):

[![Getting country data flow](https://katzmax.files.wordpress.com/2022/09/workflows_howto_loopstable_test.png?w=1024)](https://katzmax.files.wordpress.com/2022/09/workflows_howto_loopstable_test.png)
<figcaption>Getting country data flow</figcaption>

The helper flow will run 248 times for each country in the table. It will get the country and and country code.

* * *

**More resources to help you learn** :

📺 Short how-to [Workflows videos](https://youtube.com/playlist?list=PLIid085fSVdvyK8F4xuk49EchBPmAVNHG) to help you become a better automation builder.

🍿 A collection of helpful [Workflows tips](https://maxkatz.net/okta-workflows-tips/).