Flow / Power Automate - Understand the Concept of Variables and Loops in Power Automate Tutorial

Discover the essence of variables and loops in Power Automate with the tutorial "Understand the Concept of Variables and Loops in Power Automate". Learn to create a monthly scheduled flow, define variables for temporary data storage, use loops for processing individual items, and inject HTML to create clickable links. Follow the step-by-step guide to enhance your understanding and simplify complex calculations within a flow. Explore essential concepts to optimize your use of flows and achieve more efficient automation.

  • 03:55
  • 6 views
00:00:07
This is what we will cover in this tutorial,
00:00:09
particularly by introducing the principle of variables and loops
00:00:15
to best illustrate these concepts.
00:00:17
Let's create a monthly scheduled flow with the goal of listing all files stored at
00:00:21
the root of a team's channel and publishing the list as clickable items in a message
00:00:28
start by defining the recurrence.
00:00:30
Then choose the action to retrieve the files from a team's channel
00:00:34
which is of course associated with sharepoint by selecting the get files action
00:00:39
configure the relevant team's team and library.
00:00:45
Make sure to enable advanced settings if necessary such
00:00:48
as here where you want to list only the files
00:00:50
at the root of a specific channel without including
00:00:53
the content of the sub folders of this channel,
00:00:56
check the appropriate options,
00:01:00
then point to the relevant folder specifying not to include nested sub folders.
00:01:06
The final objective being to publish a single message containing all the files,
00:01:11
we will need to use a variable.
00:01:13
But what is a variable?
00:01:15
Variables are temporary storage elements used to hold your data
00:01:19
which can be used and modified during the execution of a flow.
00:01:23
They allow for storing intermediate values,
00:01:25
maintaining states and facilitating for example,
00:01:28
complex calculations within a flow.
00:01:32
Let's see how to proceed.
00:01:34
You will generate a text string containing the list of files,
00:01:38
initialize a text variable by calling the
00:01:41
initialization action via the variable keyword.
00:01:46
Give a name to your variable that you will reuse. Later
00:01:50
define the type as string which will store a character string.
00:01:53
You do not need to enter a default value in this case.
00:01:57
Now populate your variable so that it contains the list of files from your channel.
00:02:01
Do not forget to look for a command to add items to your string variable.
00:02:07
Now define your file list variable as the element to be populated.
00:02:11
Indicate that this variable will contain the file name.
00:02:15
Since there are numerous files present in the channel.
00:02:18
Recall that the SharePoint action at the start is called get files.
00:02:22
Power automate generates a for each processing loop
00:02:25
allowing each item to be processed individually.
00:02:28
And recurrently
00:02:29
indeed,
00:02:29
the variable will need to be populated as many
00:02:32
times as there are files in the team's channel.
00:02:36
To make each item clickable, you can inject some html to generate the links.
00:02:40
Use an HARF
00:02:41
tag pointing to the file link via dynamic contents as well
00:02:45
as the full file name for the text of your link.
00:02:48
Add a BR tag for a line break between each edition.
00:02:51
This syntax is quite simple but requires some knowledge of html
00:02:56
define a message from predefined items that will
00:02:59
contain your variable populated by the loop.
00:03:04
Finally create a team's post in a specific channel containing the
00:03:08
content of your message action generated in the previous action,
00:03:14
save and test your flow.
00:03:21
Although functional,
00:03:22
the message includes not only the root files of the
00:03:24
channel but also the folders which is not necessarily desired.
00:03:29
Therefore modify your flow by adding to the get files action,
00:03:33
a filter query element to exclude folders from the listed items.
00:03:37
The command is quite specific but easily retrievable on the internet.
00:03:42
Test your flow again,
00:03:43
this time, the list is more compact and excludes folders.
00:03:47
This is a simple approach related to using a variable
00:03:49
associated with a processing loop in a power automate flow.

No elements match your search in this video....
Do another search or back to content !

 

DiLeaP AI: THIS MIGHT BE HELPFUL

Reminder

Show