Part 5.1 - Text Actions: Text & List Variables

Part 5.1 - Text Actions: Text & List Variables

This is a continuation of Part 5.0: Text Actions: Overview. If you need to catch up, feel free to do so here:

In order to understand different actions, we must first understand Text and List variables, the properties of each, and how to reference their properties.

Here, we can find all the Text variable properties: https://docs.microsoft.com/en-us/power-automate/desktop-flows/datatype-properties#texts

No alt text provided for this image

Here, we can find all the List variable properties (there's only one): https://docs.microsoft.com/en-us/power-automate/desktop-flows/datatype-properties#lists

No alt text provided for this image

But don't let the variable type fool you. You can reference several other variables or properties of variables in text actions. Usually, if it is a text string, you can use several of the Text actions listed in Part 5.0 to help get what you need, such as extracting a date from a file name or adding a single value from a data table to a list for joining later.

If you have ever used PAD, you should know that variables are represented by %VariableName%. Most properties can be reference by %VariableName.PropertyName%. I say most, because in the From and To of emails retrieved through Outlook, I have had to use %VariableName.'PropertyName'% for some reason.

Now that we know all that, let's learn about Text vs List properties. It may seem self explanatory, but it can get a little confusing if you are not paying attention to what PAD is doing. Several actions pull down to a List variable type, even if there is only one item. An action such as 'Get Files' will always be a List variable type. To get the first item in the list, you reference %Files[0]%, because practically everything in PAD is a 0 based index. However, if you ask for %Files.Count% you would get 1. So, it properly counts the number of rows, but the index you need is always 1 less.

Text and List variables can look very similar at times, so be sure to pay attention to the variable type:

No alt text provided for this image

The %JoinedText% variable above has the 3 Test texts as "Test 1", [New Line], "Test 2", [New Line], "Test 3". If I wanted just one line, I would have to split that variable out first. If I try to use %JoinedText[1]%, it will result in "e", because "e" is the 2nd character. If I use %List[1]%, I will get "Test 2", because "Test 2" is the 2nd text value in the %List% variable.

I hope this gave you a better understanding of Text and List variables. We will cover Append line to text, Split text, and Join text in 5.2.

Michael Annis has no affiliation with Microsoft or its subsidiaries.?The “Best Practices” are purely compilations of his opinion and observations of conversations on the Power Automate Desktop User Community; an individual’s use of them should be taken as such.?Michael Annis has been using Robotic Process Automation (RPA) for over 2 years and maintains a “Top Solution Author” position on the Microsoft Power Automate Desktop User Community standings.?The best place for users to get their questions answered is through the User Community located here:?https://powerusers.microsoft.com/t5/Power-Automate-Desktop/bd-p/MPADesktop.

Ed Tignor

Insurance- Title/Home/Auto- A.I. Integration

3 年

Thank you for this information. The information on Microsoft's website leaves much to be desired. Reminds me of stereo instructions in the 80's. You bridge the vast gaps in technical information and actual use. Well done my friend!

要查看或添加评论,请登录

Michael Annis的更多文章

社区洞察

其他会员也浏览了