---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, widgets, tags, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: loop
layout: subsection
wd_wcptag: loop
---

<a id="section_N10021_N1001E_N10001"></a>
A utility tag for iterating through a list. The `loop` tag doesn't correspond to a widget. The main usage of a loop tag is to produce dynamic widgets based on a list of inputs.

Use `loop` on view and edit pages.

## <a id="section_xc1_3sq_h2b"></a>Example

This sample `loop` displays an iterated set of `text` tags based on a list of workers.

```
{
  "type": "fieldSet",
  "title": "Update the email address",
  "children": [
    {
      "type" : "loop",
      "label": "Loop",
      "on" : "<% workers.data %>",
      "as" : "objectToLoopOn",
      "children" : [
        {
          "type" : "text",
          "label": "<% objectToLoopOn.descriptor %>",
          "value" : "<% objectToLoopOn.person.email %>"
        }
      ]
    }
  ]
}
```

The sample `workers` endpoint:

```
{
  "baseUrlType": "workday-staffing",
  "name": "workers",
  "authType": "sso",
  "url": "<% '/workers?limit=10' %>"
}
```

## <a id="section_mobileSupport"></a>Mobile Support

Android, iOS

## <a id="section_kt1_dkg_5cb"></a>Attributes

-   <b>as</b>

    Data type: string

    Required. A string that references the current iteration in the list provided by the `on` attribute.

-   <b>children</b>

    Data type: list of tags

    A required array of widgets that the page dynamically generates. This attribute contains the template for the loop iterations. Bindings in the children can reference the "as" and "index" attribute.

-   <b>id</b>

    Data type: binding-String

    Unique identifier used to reference this widget from other tags.

    Notes:

    -   The `id` must start with a letter.
    -   The `id` must be unique per page.
    -   To enable other widgets to reference this widget `id`, place this widget before the other widgets on the PMD. The PMD validation returns an "Undefined variable" error if it doesn't find a previously defined `id` in the PMD.
    -   Workday recommends that you include the `id` in your tag definitions for debugging purposes.

-   <b>index</b>

    Data type: string

    A variable name that evaluates to the index of the current iteration. Example: If you set index to "i", you can use "i" to reference the iteration index in the children attributes.

-   <b>limit</b>

    Data type: integer

    A number that limits the number of iterations. Example: If `limit` is 4 and the `on` attribute contains 6 items, then the loop only iterates 4 times. If you don't specify `limit` or if you set it to `-1`, the loop iterates through all the data listed in the `on` attribute.

-   <b>on</b>

    Data type: dynamicBinding-List

    The list of values to iterate. The children tags will render again if the values of the list change.

-   <b>render</b>

    Data type: binding-Boolean

    If true, this tag renders as a widget on the page. If false, the loaded page doesn't add this tag or its children. The default is true.

    Unlike the `visible` attribute, when `render` is false, other tags on the page can't reference this tag or widget on edit pages. On view pages, a tag can't reference other tags regardless of the `render` attribute value.

-   <b>sortOrder</b>

    Data type: binding-String

    When you set `sorted` to true on the `section` or `fieldSet` parent of this widget, the `sortOrder` attribute determines the order of this widget within its parent. The sort order is relative to the siblings of the widget.

    Typical values are "a", "b", "c", and so on. Example: The widget with `"sortOrder": "a"` displays before the widget with `"sortOrder": "b"`.

    <b>Note:</b> The `sortOrder` doesn't apply to sorting data on the widget. `sortOrder` only applies to the placement order of the widgets within the parent widget.



