Declare variable
Declares a variable to store data while the Flow is executing.
- You can declare as many variables as you want
- A variable can be either
global
orlocal
(default). Alocal
variable can only be used within thescope
it is declared in. Aglobal
variable can be used in the entire Flow, both within Functions and Extension flowcharts. - A variable cannot be referenced unless it is assigned a value. (It will not appear in variable selectors, for example, if you try to use it as an argument to a Function). Note that this is true for both
global
andlocal
variables.
Example
This flow reads a PDF file from OneDrive, splits it into smaller chunks, assigns a unique name to each chunk (function), converts each chunk to a Word format, and uploads the resulting Word documents back to OneDrive.
The variable initialized at the beginning of the flow (called index) is used to track and generate unique names for each chunk of the PDF after it's split.
When the PDF is split into multiple chunks (pages or groups of pages), each chunk must be saved and uploaded with a unique filename to avoid overwriting previous files and to maintain proper organization.
We generate the variable first to start a counter (from 0) that we can increment for naming each file chunk.
Note
Without this step, all chunks would have the same name, and only one file would remain on OneDrive.
Read more about variables in .NET here
Properties
Name | Type | Description |
---|---|---|
Variable Name | Optional | The name of the variable. |
Data Type | Optional | The type of data the variable holds. |
Initial Value | Optional | A value or a C# expression to initialize the variable. |
Global | Optional | Indicates whether the variable is global (default is not). |
Description | Optional | A brief description of the variable's purpose. |