---
title: "Workday Extend PMD Grid dynamicColumns & Nested Arrays"
description: "Configure dynamicColumns in Workday Extend PMD grids, flatten parent-child arrays into rows, and render dynamic WQL columns using map:getKeys()."
url: https://kiweely.com/guides/workday-extend-pmd-dynamic-grid-columns-flattening-arrays
---

# Displaying dynamicColumns in a Workday Extend PMD Grid and Flattening Nested Arrays into Rows

Workday Extend developers often confuse variable child rows with runtime-generated grid columns. This guide covers flattening nested RaaS or REST arrays into grid rows, configuring dynamicColumns with cellTemplates, and rendering arbitrary WQL SELECT fields using map:getKeys().

-   **Checked** against Workday on November 6
-   Applies to **Workday Extend**
-   3 min read
-   Published November 6
-   By Kiweely

## Distinguishing Variable Child Rows from `dynamicColumns` in a PMD `grid`

In Workday Extend Presentation Metadata (PMD), `columns` and `dynamicColumns` on a `grid` widget are mutually exclusive. Before configuring `dynamicColumns`, determine whether the column headers change at runtime or whether a parent record simply contains a variable number of child items.

When a Workday Custom Report exposed as Reports-as-a-Service (RaaS) or a REST endpoint returns a parent object with a nested multi-instance group—such as a `Worker` with a nested `Dependents_group` array—the grid layout still has two fixed columns (`Worker` and `Dependent`) and a dynamic number of rows. Using `dynamicColumns` for nested parent-child arrays will not expand child records into vertical rows. Instead, flatten the nested array in a PMD script function and bind the resulting list to `rows` on a standard `grid` with static `columns`.

Reserve `dynamicColumns` for grids where the column definitions (header labels, column IDs, data types, and field paths) come from an endpoint or runtime metadata list, or use indexed `map:getKeys()` column bindings when rendering ad-hoc Workday Query Language (WQL) results whose `SELECT` attributes are unknown at design time.

## Pattern 1: Flattening Nested Parent-Child Arrays into Grid Rows

Consider a RaaS JSON payload where each `Report_Entry` item represents a worker and contains a `Dependents_group` array of varying length:

json

```
{
  "Report_Entry": [
    {
      "Worker": "Alex Rivera",
      "Dependents_group": [
        { "Dependent": "Megan McNeil" },
        { "Dependent": "Pat McNeil" }
      ]
    },
    {
      "Worker": "Steve Morgan",
      "Dependents_group": [
        { "Dependent": "Catherine Morgan" },
        { "Dependent": "Elizabeth Morgan" },
        { "Dependent": "Josh Morgan" }
      ]
    }
  ]
}
```

A PMD `grid` renders one row per element in the list bound to `rows`. To display each dependent on its own row while showing the worker’s name only on the first row of each group, define a helper function in the PMD `script` block that iterates through both the outer `Report_Entry` array and the inner `Dependents_group` array:

javascript

```
"script": "<%
  var buildGridRows = function() {
    var result = [];
    var reportEntries = raasEndpoint.Report_Entry ?? [];
    for (var entry : reportEntries) {
      var dependents = entry.Dependents_group ?? [];
      if (empty dependents) {
        result.add({
          'Worker': entry.Worker,
          'Dependent': ''
        });
      } else {
        for (var i = 0; i < dependents.size(); i++) {
          var workerName = (i == 0) ? entry.Worker : '';
          result.add({
            'Worker': workerName,
            'Dependent': dependents[i].Dependent
          });
        }
      }
    }
    return result;
  };
%>"
```

Bind `rows` on the `grid` directly to `<% buildGridRows() %>` and reference the flattened properties through `rowVariableName`:

json

```
{
  "type": "grid",
  "id": "workerDependentGrid",
  "label": "Worker Dependents",
  "rows": "<% buildGridRows() %>",
  "rowVariableName": "row",
  "doNotAdd": true,
  "doNotRemove": true,
  "columns": [
    {
      "type": "column",
      "columnId": "workerCol",
      "label": "Worker",
      "cellTemplate": {
        "type": "text",
        "value": "<% row.Worker %>"
      }
    },
    {
      "type": "column",
      "columnId": "dependentCol",
      "label": "Dependent",
      "cellTemplate": {
        "type": "text",
        "value": "<% row.Dependent %>"
      }
    }
  ]
}
```

## Pattern 2: Configuring `dynamicColumns` with `cellTemplates`

When the columns themselves must be generated from a metadata list—for example, when multiple text, date, or boolean columns share a set of reusable cell templates or when an endpoint supplies the column list—use the `dynamicColumns` child tag together with `cellTemplates[]` on the `grid`.

Every `dynamicColumns` configuration requires six attributes (`id` is optional and used only for debugging):

-   `columns`: A binding to a list of column metadata objects.
-   `columnVariableName`: The iterator variable name representing each item in `columns`.
-   `columnId`: Binding to the unique identifier attribute on `columnVariableName`.
-   `label`: Binding to the column header title on `columnVariableName`.
-   `templateId`: Binding to the type key on `columnVariableName` that matches a `templateId` entry in the grid’s `cellTemplates[]` array.
-   `attributeName`: Binding to the field name or nested path in each row object (for example, `'descriptor'` or `'primaryJob.supervisoryOrganization.descriptor'`).

json

```
{
  "type": "grid",
  "id": "gridWithDynamicColumns",
  "label": "Workers Directory",
  "rowVariableName": "row",
  "rows": "<% workersEndpoint.data ?? [] %>",
  "dynamicColumns": {
    "type": "dynamicColumns",
    "columns": "<%
      [
        {
          'name': 'Worker Name',
          'id': 'descriptorCol',
          'type': 'stringTemplate',
          'dataField': 'descriptor'
        },
        {
          'name': 'Supervisory Organization',
          'id': 'supOrgCol',
          'type': 'stringTemplate',
          'dataField': 'primaryJob.supervisoryOrganization.descriptor'
        }
      ]
    %>",
    "columnVariableName": "aColumn",
    "columnId": "<% aColumn.id %>",
    "label": "<% aColumn.name %>",
    "templateId": "<% aColumn.type %>",
    "attributeName": "<% aColumn.dataField %>"
  },
  "cellTemplates": [
    {
      "type": "cellTemplate",
      "templateId": "stringTemplate",
      "template": {
        "type": "text"
      }
    }
  ]
}
```

Because `attributeName` automatically binds the cell widget’s value to the corresponding property in `rows`, the `text` widget inside `cellTemplates` does not declare a manual `value` binding.

## Pattern 3: Rendering Arbitrary WQL Columns with `map:getKeys()`

When building a dynamic WQL query runner or report previewer where the attributes in the `SELECT` clause are not known until the query executes, you can inspect the keys of the first returned row (`wqlResult[0]`) using `map:getKeys()`. Define a set of indexed `column` slots inside a `dynamicSection` pod and control each column’s presence with a `render` condition checking `map:getKeys(data.wqlResult[0]).size() > index`:

json

```
{
  "type": "grid",
  "id": "queryResultsGrid",
  "label": "Query Results",
  "render": "<% !empty data.wqlResult %>",
  "enabled": false,
  "rows": "<% data.wqlResult %>",
  "rowVariableName": "queryResult",
  "doNotAdd": true,
  "doNotRemove": true,
  "selectionEnabled": false,
  "columns": [
    {
      "type": "column",
      "id": "col0",
      "columnId": "0",
      "label": "<% map:getKeys(data.wqlResult[0]).get(0) %>",
      "render": "<% map:getKeys(data.wqlResult[0]).size() > 0 %>",
      "cellTemplate": {
        "type": "text",
        "value": "<% queryResult[map:getKeys(data.wqlResult[0]).get(0)] %>"
      }
    },
    {
      "type": "column",
      "id": "col1",
      "columnId": "1",
      "label": "<% map:getKeys(data.wqlResult[0]).get(1) %>",
      "render": "<% map:getKeys(data.wqlResult[0]).size() > 1 %>",
      "cellTemplate": {
        "type": "text",
        "value": "<% queryResult[map:getKeys(data.wqlResult[0]).get(1)] %>"
      }
    }
  ]
}
```

When a user triggers a deferred WQL endpoint via a `pageActionButton`, call `resultsDynamicSection.setData({'wqlResult': response.data})` to refresh the `dynamicSection` container. The grid evaluates `map:getKeys(data.wqlResult[0])`, sets each column header to the WQL field alias, and hides any unused column slots where `size() <= index`.

## How to Verify in the Tenant

1.  Deploy the updated PMD page to your Workday Extend development tenant using `wdcli` or **App Builder**.
2.  For nested parent-child arrays (Pattern 1), open the page and confirm that workers with multiple dependents render across consecutive rows with the worker name displayed on the first row of each group and blank worker cells on subsequent dependent rows.
3.  For `dynamicColumns` (Pattern 2), inspect the page in the tenant to verify that every entry in the `columns` metadata list matches a valid `templateId` in `cellTemplates[]` and renders the nested `attributeName` path without schema validation errors in **View Application Logs**.
4.  For dynamic WQL grids (Pattern 3), execute queries with different numbers of `SELECT` fields and confirm that only the active column slots render and populate their headers from `map:getKeys()`.

## Sources checked

-   [dynamicColumns PMD Tag Reference](https://developer.workday.com/documentation/kfa1570080048883)
-   [Concept: grid](https://developer.workday.com/documentation/tgx1652476064414)
-   [grid PMD Tag Reference](https://developer.workday.com/documentation/zmz1518211268000)
-   [Reference: PMD Scripting Syntax](https://developer.workday.com/documentation/snh1581402351791)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Why a RaaS Endpoint Returns HTTP 200 with data as null in PMD and How to Surface SOAP Fault Messages Workday RaaS JSON endpoints wrap rows inside Report\_Entry instead of data, causing raasEndpoint.data to evaluate to null in PMD. Learn how to parse Report\_Entry, avoid list:excludeMultiple() errors on string lists, and surface SOAP fault messages from synchronous orchestrations.](https://kiweely.com/guides/workday-extend-pmd-raas-report-entry-null-soap-fault-http-200)
-   [### Deleting Selected Grid Rows and Fixing Parallel Multi-Instance Arrays Collapsing on Edit Pages in Workday Extend PMD Workday Extend PMD does not permit outbound DELETE calls inside onRowSelect, and storing grid columns as separate multi-instance fields on a single BO record causes edit grids to collapse into one row. Learn how to handle row deletion on submit and zip parallel arrays by index.](https://kiweely.com/guides/workday-extend-pmd-grid-delete-selected-rows-parallel-arrays-collapse)
-   [### Clearing Grid Cell Validation Errors on onChange and Blocking Page Save on pageActionButton Failure in Workday Extend PMD Learn how to clear cell-level validation errors in Workday Extend PMD grids when a user updates a cell, avoid the getSelectedRows() border-highlighting trap during onSubmit, and block page submission when a pageActionButton deferred WQL lookup fails.](https://kiweely.com/guides/workday-extend-pmd-clear-grid-cell-error-pageactionbutton-block-save)

### More guides on Extend apps and pages

[All 97 guides](https://kiweely.com/guides#extend)

-   [Conditional Page Routing on Load, multiStepLayout vs. tabBar Navigation, and flowVariables Payload Limits in Workday Extend PMD](https://kiweely.com/guides/workday-extend-pmd-conditional-page-routing-tabbar-flowvariables-limits)
-   [Resolving “Tenant mapping not found (OP-4008)”, EU vs. US Regional Base URL 401 Errors, and client\_secret\_basic in Workday Extend OAuth 2.0](https://kiweely.com/guides/workday-extend-oauth-tenant-mapping-op-4008-eu-base-url-client-secret-basic)
-   [Working Around the 10-Relationship Limit on a Workday Extend Model Business Object (MCBO) Using a Helper Object](https://kiweely.com/guides/workday-extend-mcbo-10-single-instance-relationship-limit-helper-bo)
-   [How to Blank Out Text Fields and Nullify Reference Values on Workday Extend Business Objects via Inbound EIB Using {empty}](https://kiweely.com/guides/workday-extend-eib-clear-text-nullify-fields-empty-tag)
-   [Fixing “Object instance has properties which are not allowed by the schema (parentBusinessProcesses, initiationPageRoute)” on Extend Subprocesses](https://kiweely.com/guides/workday-extend-bp-subprocess-allowedparentprocesses-eventstepid)
-   [Cascading dropdowns and instance lists in Workday Extend](https://kiweely.com/guides/workday-extend-cascading-instance-lists)
-   [How to move Workday Extend apps to a new developer tenant before the old one expires or is deleted](https://kiweely.com/guides/workday-extend-move-apps-new-developer-tenant)
-   [Why a Workday Graph API query suddenly fails with “Cannot query field”](https://kiweely.com/guides/workday-graphql-cannot-query-field)

### From the blog on Extend apps and pages

[All posts](https://kiweely.com/blog)

-   [How do you test a Workday Extend app end to end?](https://kiweely.com/blog/test-workday-extend-app-end-to-end)
-   [When a Workday Custom Report Is Enough vs. When You Need Prism or an Extend App](https://kiweely.com/blog/when-workday-custom-report-is-not-enough)
-   [Five Workday Extend app blueprints you can build in a free personal tenant](https://kiweely.com/blog/five-workday-extend-apps-to-build-in-open-developer-program)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
