Microsoft PowerApps does not currently support indexing in collections. There are some differences between true arrays (e.g. JavaScript) and PowerApps collections. Microsoft has commented that indexing will not be supported in collections (at least in the near future). With that, the closest data structure in to arrays in PowerApps is tables. However, I prefer to work will collections and with that I wanted to come up with a solution to index them.

The formula itself is simple; loop through your original collection (e.g. SharePoint list items, drop-down options, etc.) and then copy it to a new collection. While collecting each item, count the rows of the collection as it grows. That’s it, so what does that look like?

Here’s my original collection of statuses:

collection_originalStatuses = ["New", "Pending", "Complete"]

// loop through the original collection
// copy each one to a new collection
// create an object with the value (or other props) and an index
Value: Value,
// the index starts at 0 and increments as each item is copied
Index: CountRows(collection_indexedStatuses)

Here’s my indexed collection after the ForAll() loop above:

collection_indexedStatuses = [
{Value: "New", Index: 0},
{Value: "Pending", Index: 1},
{Value: "Complete", Index: 2}

To see a practical application of the technique check out my YouTube How To on indexing collections here: