Power Automate: skip Function

Power Automate: skip Function

by: Manuel ⏱️ 📖 5 min read 💬 0

Power Automate provides the "skip" function to remove items from the front of an array and return everything else. It's the counterpart to the "take" function - where "take" grabs items from the beginning, "skip" throws them away and gives you what's left.

Usage

It follows a simple pattern.

  1. Collection (array)
  2. Count (positive integer - the number of items to skip)

Here's a basic example:

skip(createArray(0, 1, 2, 3), 1)

will return

[1, 2, 3]

It removed the first item (0) and returned the rest.

Skipping multiple items

skip(createArray(0, 1, 2, 3), 2)

will return

[2, 3]

The first two items are gone, and you get the remaining items.

Skipping the first item in a loop

A common use case is processing all items in an array except the first one. For example, if you have a sorted list and want to skip the top result:

skip(outputs('List_rows')?['body/value'], 1)

This removes the first item and returns the rest for processing.

Working with arrays of objects

The "skip" function works with arrays containing any type of element - numbers, strings, objects, or even nested arrays. When you skip items from an array of JSON objects (like SharePoint list items), the objects are preserved intact with all their properties.

Removing the last item

The "skip" function removes items from the front, but you can combine it with the "length" function and the "take" function to remove items from the end instead:

take(variables('MyArray'), sub(length(variables('MyArray')), 1))

This takes all items except the last one.

Edge Cases

Count exceeds array length

If you skip more items than the array contains, you get an empty array - no error:

skip(createArray(1, 2, 3), 10)

will return

[]

This is good to know because it means you don't need to check the array length before using "skip."

Count of zero

Skipping zero items returns the original array unchanged:

skip(createArray(1, 2, 3), 0)

will return

[1, 2, 3]

Empty arrays

Skipping items from an empty array returns an empty array:

skip(json('[]'), 5)

will return

[]

Negative count

The count parameter must be a positive integer. Passing a negative number will cause an error.

Null input

Passing null as the collection causes a runtime error, even though an empty array works fine. If there's a chance your array could be null, wrap it with the "coalesce" function to provide a fallback:

skip(coalesce(variables('MyArray'), json('[]')), 1)

This ensures you always pass a valid array to "skip."

No direct array indexing

You cannot index the result of "skip" directly in a single expression. For example, skip(myArray, 2)[0] does not work. Instead, use the "first" function to grab the first item from the result:

first(skip(variables('MyArray'), 2))

Or assign the "skip" result to a variable first and then index into it.

Limitations

Arrays only (maybe)

Microsoft's older documentation lists the first parameter as "String or Array," and community sources confirm that skip('hello world', 6) returns "world" in practice. However, the newer expression functions reference page lists the parameter as "Array" only. This is an inconsistency in Microsoft's documentation. In practice it appears to work with strings, but since the newer docs removed that mention, rely on the "substring" function for string operations to be safe.

Cloud flows only

The "skip" function is available in cloud flows only. Power Automate Desktop does not have a "skip" function equivalent. In Desktop flows, you'll need to use loop-based approaches or .NET scripting for similar array manipulation.

Performance with connectors

Using "skip" on connector output like SharePoint "Get Items" action operates client-side. All records are fetched into memory first, and then "skip" removes items from the result. For large lists, use the OData $skip query parameter in the connector settings instead - it filters at the server level and is far more performant.

No "skip from end" parameter

The function always removes items from the front. If you need to remove items from the end, you'll need to use "take" with a calculated count, or combine "reverse", "skip," and "reverse" again.

Count must be static or calculated

You can't dynamically skip items based on a condition within the function itself. The count must be a fixed number or a calculated expression.

Recommendations

Here are some things to keep in mind.

Pair with take for slicing

Together, "skip" and "take" let you extract any portion of an array. To get items from position 3 to 5:

take(skip(variables('MyArray'), 2), 3)

This skips the first 2 items, then takes the next 3. It's the Power Automate equivalent of array slicing.

Combine with length for dynamic pagination

For pagination scenarios, calculate the skip count based on page number and page size:

skip(variables('AllItems'), mul(variables('PageNumber'), variables('PageSize')))

Use Compose instead of variables

When you only need the "skip" result temporarily, use a "Compose" action instead of storing it in a variable. "Compose" executes faster than variable assignment for array operations, and it keeps your flow cleaner.

Always add a comment

Adding a comment will help others understand your formula. Indicate what the function is doing and why, especially if the expression is complex.

Final Thoughts

The "skip" function is a simple but essential tool for working with arrays in Power Automate. Whether you're removing headers, implementing pagination, or slicing arrays in combination with "take," it handles the job cleanly. Watch out for null inputs and remember that it operates client-side on connector data, so use OData parameters for large datasets. Beyond that, it's straightforward - just remember it works from the front of the array only, and you'll be all set.

Sources

Microsoft's "skip" Function Reference

Back to the Power Automate Function Reference

Photo by Jessica Mangano on Unsplash

Comments

💬

No comments yet

Be the first to share your thoughts on this article!

Leave a Comment

All comments are reviewed for spam before being displayed 5000 left
Replying to