# Looping through items in a collection of records - Workflows

**URL:** <https://community.dynatrace.com/t/looping-through-items-in-a-collection-of-records-workflows/46370>\
**Category:** Automations\
**Tags:** integrations, workflows, automations\
**Created:** [June 28, 2024, 12:14pm UTC](https://community.dynatrace.com/t/looping-through-items-in-a-collection-of-records-workflows/46370 "2024-06-28T12:14:00Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![badgerfifteen](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@badgerfifteen](https://community.dynatrace.com/u/badgerfifteen)\
**Post date:** [June 28, 2024, 12:14pm UTC](https://community.dynatrace.com/t/looping-through-items-in-a-collection-of-records-workflows/46370/1 "2024-06-28T12:14:00Z")

</div>

What I need is to loop through all of the records from a DQL output and have it formatted in a human-readable format.

Here is my DQL query

```markup
timeseries percent = avg(dt.host.disk.used.percent), by: { dt.entity.host, dt.entity.disk }, filter: { in(dt.entity.host, classicEntitySelector("type(host),tag(\"Business Unit:FINANCE\")")) }
| fields util = abs(arrayAvg(percent)), entityName(dt.entity.host)
| fieldsRename dt.entity.host.name, Host

```

…which if I use get\_disk\_stats.records, equivalent to {{ result(“get\_disk\_stats”)[“records”] }}, I get the following output:

```markup
[
  {
    "Host": "WIN11023.corporate.org",
    "util": 73.14564947430772
  },
  {
    "Host": "WIN19876.corporate.org",
    "util": 49.68959838117046
  },
  {
    "Host": "WIN11234.corporate.org",
    "util": 37.80735823445836
  },
  {
    "Host": "WIN15678.corporate.org",
    "util": 69.33072939353247
  },
  {
    "Host": "WIN19987.corporate.org",
    "util": 37.659657944489574
  },
  {
    "Host": "WIN12045.corporate.org",
    "util": 42.12913605995685
  },
  {
    "Host": "WIN13456.corporate.org",
    "util": 0.5479891637632675
  }
]

```

How do I code the for loop within the input itself or in the ‘Options’ menu?

---

_[View the full topic](https://community.dynatrace.com/t/looping-through-items-in-a-collection-of-records-workflows/46370)._
