Skip to content

Power Automate

5 Surprising Power Automate Select Action Tricks

5 Surprising Power Automate Select Action Tricks Posted by - Matthew Devaney on - August 11, 2024 15 Comments The Power Automate select action can be used to...

Matthew Devaney
Published
Reading time
4 min read

Before you start

Is this guide for you?

Best entry point
Power Automate
Time investment
4 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/5-surprising-power-automate-select-action-tricks/. Author: Matthew Devaney.

5 Surprising Power Automate Select Action Tricks Posted by - Matthew Devaney on - August 11, 2024 15 Comments

The Power Automate select action can be used to do more than simply selecting the specified columns of an array. With it we can add new columns to an array, update existing values in an array, add an index number and more. The examples shared in this article will likely surprise you and lead to think of additional use cases. Table of Contents

Select The Specified Columns Of An Array Add A New Column To An Array

Add The Index Position For Each Item To An Array

Convert Text To A Number Column In An Array

Create An Array List Of Values With No Column Names

Select The Specified Columns Of An Array

The Power Automate Select action can be used to select specific columns from an array and remove the other columns. For example, assume there is an array of test scores with the columns: student, test and score. We can select the student and test columns and drop the score column. Code Map Student field: item ()? [ 'Student' ] Code language: CSS ( css ) Map Test field: item ()? [ 'Test' ] Code language: CSS ( css ) Result Add A New Column To An Array

To add a new column to a Power Automate array we can use a combination of the select action and the addProperty function . First we switch the select action map field to text mode we make it display a single field. Then we input the addProperty function with the new column name and value. The select action loops over each row in the array and adds the new column. Code Map field:

addProperty(item(), 'Passed' ,greaterOrEquals(int(item()?[ 'Score' ]), 50 )) Code language: JavaScript ( javascript ) Result

Add The Index Position For Each Item To An Array

The index position (or row number) can be added to the array using the addProperty function . After switching the map field of the select action to text mode we can use a simple expression to insert and index number for each item. The index will start at 0 by default. If we wanted the index to start at 1 instead we could use the add function to increment the index by 1. Code From field:

range( 0 , length(variables( 'Test Scores' ))) Code language: JavaScript ( javascript ) Map field:

addProperty(variables( 'Test Scores' )[item()], 'Index' ,item()) Code language: JavaScript ( javascript ) Result

Convert Text To A Number Column In An Array

Often times numbers are found as a text data type inside of an array. The setProperty function can be used to change a string column to a number column. We do this by adding the setProperty function to the map property of a select action supplying the column name and a function to convert to a new data type. In this example we use the int function to change the text string to an integer. We could also use the decimal function or the float function as well. Code Map field:

setProperty(item(), 'Score' ,int(item()?[ 'Score' ])) Code language: JavaScript ( javascript ) Result

Create An Array List Of Values With No Column Names

A Power Automate array list is a list of values with no column names. They are helpful for finding a list of unique values and doing contains/does not contain comparisons. To create an array list add a select action and change the map field to text mode. Then we add the dynamic value for the field we want to create the array list for. Code Map field: item ()? [ 'Student' ] Code language: CSS ( css ) Result Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about 5 Surprising Power Automate Select Action Tricks please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate

Save Docusign Document To SharePoint With Power Automate

Share this

Tagged

Power Automate

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →