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
  • 40 views

Objectifs :

This tutorial aims to deepen your understanding of using flows in Power Automate by introducing essential concepts such as variables and loops. You will learn how to create a monthly scheduled flow that lists all files stored at the root of a team's channel and publishes them as clickable items in a message.


Chapitres :

  1. Introduction to Flows
    In this tutorial, we will explore the essential concepts of variables and loops in Power Automate. These concepts are crucial for enhancing your use of flows, particularly when creating automated processes.
  2. Creating a Monthly Scheduled Flow
    We will create a monthly scheduled flow with the goal of listing all files stored at the root of a team's channel. The final output will be a message containing clickable items representing these files.
  3. Defining Recurrence
    Start by defining the recurrence for your flow. This sets the schedule for how often the flow will run.
  4. Retrieving Files from SharePoint
    Choose the action to retrieve files from a team's channel, which is associated with SharePoint. Select the 'Get files' action and configure the relevant team's site and library. Make sure to enable advanced settings to list only the files at the root of a specific channel, excluding subfolders.
  5. Understanding Variables
    Variables are temporary storage elements used to hold data during the execution of a flow. They allow for storing intermediate values, maintaining states, and facilitating complex calculations.
  6. Initializing a Variable
    To store the list of files, initialize a text variable by calling the initialization action. Name your variable and define its type as 'string' to store character strings. You do not need to enter a default value.
  7. Populating the Variable
    Populate your variable with the list of files from your channel. Look for a command to add items to your string variable and define your file list variable as the element to be populated with file names.
  8. Using Loops to Process Files
    Power Automate generates a 'for each' processing loop, allowing each item to be processed individually. The variable will need to be populated as many times as there are files in the team's channel.
  9. Creating Clickable Links
    To make each item clickable, inject HTML to generate links. Use an 'A' tag pointing to the file link via dynamic content, along with the full file name for the text of your link. Add a 'BR' tag for line breaks between each item.
  10. Defining the Message
    Define a message from predefined items that will contain your variable populated by the loop. Create a team's post in a specific channel containing the content of your message.
  11. Testing the Flow
    Save and test your flow. Initially, the message may include not only the root files but also folders, which may not be desired.
  12. Modifying the Flow
    To exclude folders from the listed items, modify your flow by adding a filter query element to the 'Get files' action. This command is specific but easily retrievable online.
  13. Final Testing
    Test your flow again. This time, the list should be more compact and exclude folders, demonstrating a simple approach to using a variable associated with a processing loop in a Power Automate flow.

FAQ :

What is a flow in Power Automate?

A flow in Power Automate is an automated workflow that connects different applications and services to perform tasks automatically, reducing the need for manual intervention.

How do I create a variable in Power Automate?

To create a variable in Power Automate, use the 'Initialize variable' action, give it a name, define its type (e.g., string), and optionally set a default value.

What is the purpose of loops in a flow?

Loops in a flow allow you to process multiple items individually by repeating a set of actions for each item until all items have been processed.

How can I exclude folders when retrieving files from SharePoint?

To exclude folders when retrieving files from SharePoint in Power Automate, you can add a filter query to the 'Get files' action to specify that only files should be listed.

What is the significance of using HTML in Power Automate?

Using HTML in Power Automate allows you to format messages, create clickable links, and enhance the presentation of information in notifications or messages sent through flows.

Can I test my flow after creating it?

Yes, you can test your flow after creating it to ensure it functions as expected. You can save and run the flow to see the results and make any necessary adjustments.


Quelques cas d'usages :

Automating File Retrieval from SharePoint

In a corporate environment, a team can use Power Automate to create a flow that automatically retrieves and lists all files from a specific SharePoint channel. This can save time and ensure that team members have easy access to important documents without manually searching through folders.

Generating Clickable Reports

A marketing team can utilize Power Automate to generate a report that lists all campaign files as clickable links in a message. This allows team members to quickly access relevant documents directly from the report, improving efficiency in project management.

Scheduled Notifications for File Updates

An IT department can set up a scheduled flow that checks for new files in a SharePoint channel every month and sends a notification to the team with a list of new files. This ensures that everyone stays updated on the latest resources available.

Excluding Unwanted Items in File Lists

When creating a flow to list files, a project manager can implement a filter query to exclude folders from the list. This ensures that the team only sees relevant files, making it easier to find what they need without clutter.


Glossaire :

Flow

A flow is an automated workflow that connects different applications and services to perform tasks without manual intervention.

Variables

Variables are temporary storage elements used to hold data that can be modified during the execution of a flow. They allow for storing intermediate values and maintaining states.

Loops

Loops are programming constructs that repeat a set of instructions until a specified condition is met. In flows, they allow for processing multiple items individually.

SharePoint

SharePoint is a web-based collaboration platform that integrates with Microsoft Office. It is used for storing, organizing, sharing, and accessing information from any device.

HTML

HTML (HyperText Markup Language) is the standard markup language for documents designed to be displayed in a web browser. It is used to create web pages and applications.

HARF

HARF appears to be a typo; it likely refers to 'href', which is an HTML attribute used to specify the URL of the page the link goes to.

Power Automate

Power Automate is a cloud-based service that allows users to create automated workflows between applications and services to synchronize files, get notifications, collect data, and more.

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 !

 

Mandarine AI: CE QUI POURRAIT VOUS INTÉRESSER

Reminder

Show