10.2 Variables, Data Operations & Dynamic Content Manipulation

Key Takeaways

  • Variables in Power Automate are stateful, globally scoped containers; 'Initialize variable' actions MUST reside at the flow's top root level and cannot be placed inside scopes or conditional branches.
  • Power Automate supports six variable data types: Boolean, Integer, Float, String, Object, and Array, modified via Set, Increment, Decrement, Append to string, and Append to array actions.
  • Data Operations (Compose, Parse JSON, Select, Filter array, Join, Create CSV/HTML table) are stateless, highly performant, in-memory operations that eliminate costly loop-and-append patterns.
  • Parse JSON converts raw JSON payloads into strongly typed dynamic content tokens using a JSON Schema, which can be automatically inferred from a sample payload.
  • The Select action transforms array structures by projecting and renaming properties, while Filter array extracts subsets matching boolean criteria without iterating through an Apply to each container.
Last updated: August 2026

Variables, Data Operations & Dynamic Content Manipulation

Efficient cloud flow design requires a clear separation between stateful variable management and declarative data transformation. While variables provide mutable storage across a flow's execution lifecycle, relying on loops and variable mutations to reshape data introduces performance bottlenecks and thread-safety risks. Microsoft Power Automate provides the built-in Data Operations suite to perform high-speed, in-memory manipulations on JSON objects and arrays without procedural looping.

For the PL-200: Microsoft Power Platform Functional Consultant exam, you must know when to use variables versus data operations, understand root-level variable initialization constraints, master JSON schema extraction with Parse JSON, and leverage declarative actions like Select, Filter array, and Join.


1. Variables Architecture & Scope Rules

A Variable is a named, mutable memory container allocated in the flow runtime environment. Once initialized, a variable can be read, updated, incremented, or appended to by any downstream action across the flow.

+-----------------------------------------------------------------------------+
|                        VARIABLE LIFECYCLE & ACTIONS                         |
|                                                                             |
|   [ROOT LEVEL OF FLOW]                                                      |
|   +---------------------------------------------------------------------+   |
|   | ACTION: Initialize variable                                         |   |
|   | - Name:        varCustomerSummary                                   |   |
|   | - Type:        String, Integer, Float, Boolean, Object, Array       |   |
|   | - Value:       Initial payload (optional)                           |   |
|   +---------------------------------------------------------------------+   |
|                                     |                                       |
|                                     v                                       |
|   [DOWNSTREAM ACTIONS / BRANCHES / LOOPS]                                   |
|   +---------------------------------------------------------------------+   |
|   | - Set variable:                Overwrites current value             |   |
|   | - Increment / Decrement:       Adds / subtracts numeric offset      |   |
|   | - Append to string variable:   Concatenates text to string          |   |
|   | - Append to array variable:    Pushes item/object into array        |   |
|   +---------------------------------------------------------------------+   |
+-----------------------------------------------------------------------------+

The Root-Level Initialization Rule

In Power Automate, Initialize variable actions can ONLY be placed at the root level of the flow. They cannot be nested inside any container action, including:

  • Scope containers
  • Condition (If yes / If no branches)
  • Switch (Case or Default branches)
  • Apply to each loops
  • Do Until loops

If you need to assign a variable conditionally, you must initialize the variable at the top of the flow (with an empty or default value) and use Set variable inside the conditional branch.

Supported Variable Data Types

Variable TypeUnderlying JSON TypeDescription & Example Use Case
Booleanbooleantrue or false. Flagging whether a customer requires manual credit review.
Integerinteger64-bit signed whole number (e.g., 42, -10). Counting processed invoice rows.
FloatnumberDouble-precision decimal number (e.g., 99.95, 0.05). Storing tax percentages or currency balances.
StringstringUnicode text. Accumulating formatted notes or constructing an email body.
ObjectobjectJSON key-value dictionary (e.g., {"id": 101, "tier": "Gold"}). Storing structured metadata.
ArrayarrayOrdered collection of scalars or JSON objects (e.g., ["A", "B", "C"]). Accumulating record GUIDs.

2. Variable Manipulation Actions

Action NameCompatible TypesOperational Behavior
Set variableAll typesCompletely overwrites the existing value with a new value of the same type.
Increment variableInteger, FloatIncreases the variable by a specified positive or negative numeric value.
Decrement variableInteger, FloatDecreases the variable by a specified positive or negative numeric value.
Append to string variableStringAppends text to the end of the existing string value without overwriting.
Append to array variableArrayAppends a new element (scalar value or JSON object) to the end of the array.

3. Data Operations Suite

The built-in Data Operations connector provides high-speed, in-memory tools for reshaping, filtering, parsing, and converting data payloads. Unlike variables, Data Operations are stateless and produce immutable output tokens.

+-----------------------------------------------------------------------------+
|                           DATA OPERATIONS ECOSYSTEM                         |
|                                                                             |
|   [COMPOSE]            ---> Evaluates expressions, formats scratchpad data  |
|   [PARSE JSON]         ---> Generates typed dynamic tokens from JSON string |
|   [SELECT]             ---> Projects and reshapes array objects             |
|   [FILTER ARRAY]       ---> Extracts matching items without looping         |
|   [JOIN]               ---> Flattens array into delimited string (e.g. '; ')|
|   [CREATE CSV TABLE]   ---> Converts JSON array into comma-separated text   |
|   [CREATE HTML TABLE]  ---> Converts JSON array into HTML <table> markup    |
+-----------------------------------------------------------------------------+

1. Compose Action

The Compose action evaluates any expression, static text, or dynamic token and stores the result as an immutable output (outputs('Compose_Name')). Common uses:

  • Creating reusable constants or complex WDL calculations (e.g., calculating tax amounts once and referencing the output multiple times).
  • Constructing ad-hoc JSON payloads for downstream HTTP calls.
  • Debugging expressions by inspecting step inputs and outputs in run history.

2. Parse JSON Action

Cloud APIs and HTTP actions often return unformatted JSON strings. While Power Automate can store the string, individual properties are inaccessible as dynamic content. Parse JSON analyzes the string against a JSON Schema and generates strongly typed dynamic tokens.

+-----------------------------------------------------------------------------+
|                        PARSE JSON WORKFLOW PIPELINE                         |
|                                                                             |
|   [RAW JSON STRING (HTTP Payload)]                                          |
|   '{"customerId": "C-892", "creditLimit": 75000, "active": true}'            |
|                 |                                                           |
|                 v                                                           |
|   +---------------------------------------------------------------------+   |
|   | ACTION: Parse JSON                                                  |   |
|   | Content: body('HTTP_Call')                                          |   |
|   | Schema:  {"type": "object", "properties": { ... }}                   |   |
|   +---------------------------------------------------------------------+   |
|                 |                                                           |
|                 +---> (Click 'Use sample payload to generate schema')       |
|                 |                                                           |
|                 v                                                           |
|   [EXPOSED DYNAMIC CONTENT TOKENS]                                          |
|   - customerId (String)  |  creditLimit (Integer)  |  active (Boolean)      |
+-----------------------------------------------------------------------------+

[!TIP] Handling Null Values in JSON Schemas: If an incoming API payload contains a property that might be null (e.g., "middleName": null), a strict schema "type": "string" will throw a runtime BadRequest validation error. Edit the schema manually to allow nullable types: "type": ["string", "null"] or "type": ["integer", "null"].

3. Select Action (Array Transformation)

The Select action transforms an array of objects into a new array with a modified structure or fewer attributes. It takes an input array (From) and evaluates a mapping dictionary (Map) for every element in a single, lightning-fast in-memory operation.

// Input Array (From: Dataverse 'List rows'):
[
  {"accountid": "001", "name": "Contoso Ltd", "revenue": 500000, "address1_city": "Seattle"},
  {"accountid": "002", "name": "Fabrikam Inc", "revenue": 250000, "address1_city": "Dallas"}
]

// Select Mapping Definition:
// AccountName  --> item()?['name']
// City         --> item()?['address1_city']

// Output Array of Select action:
[
  {"AccountName": "Contoso Ltd", "City": "Seattle"},
  {"AccountName": "Fabrikam Inc", "City": "Dallas"}
]

4. Filter Array Action

The Filter array action extracts a subset of elements from an array that meet specific boolean criteria. It accepts an input array (From) and evaluates a condition row (e.g., item()?['revenue'] is greater than 300000). Only items where the condition evaluates to true are included in body('Filter_array').

5. Join Action

The Join action takes an array of strings or scalars and concatenates them into a single string separated by a specified delimiter.

Input Array:   ["alice@contoso.com", "bob@contoso.com", "charlie@contoso.com"]
Join Delimiter: "; "
Output String: "alice@contoso.com; bob@contoso.com; charlie@contoso.com"

6. Create CSV Table & Create HTML Table

These actions convert an array of JSON objects into structured tables:

  • Create CSV table: Outputs standard comma-delimited text, perfect for generating flat file attachments.
  • Create HTML table: Outputs an HTML <table>...</table> markup string, ideal for embedding directly into automated notification emails or Teams messages.
  • Columns Property: Set to Automatic (inherits all object keys as headers) or Custom (allows defining explicit column header names and mapped expression values).

4. The Anti-Pattern: Loops vs. Declarative Pipelines

A critical functional skill tested on the PL-200 exam is replacing inefficient, procedural loops with declarative Data Operations.

+-----------------------------------------------------------------------------+
|             PROCEDURAL ANTI-PATTERN VS DECLARATIVE PIPELINE                 |
|                                                                             |
|   [ANTI-PATTERN: LOOP & APPEND]             [RECOMMENDED: DATA OPERATIONS]  |
|   - 'List rows' (5,000 records)             - 'List rows' (5,000 records)   |
|   - Apply to each (Sequential)              - Filter array (High value)     |
|     - Condition (Revenue > 50K)             - Select (Project Name/Email)   |
|       - Append to array variable            - Join (Delimiter '; ')         |
|   Execution Time: 5 to 15 minutes           Execution Time: < 1.5 seconds   |
|   API Calls Consumed: 5,000+                API Calls Consumed: 3           |
+-----------------------------------------------------------------------------+

5. Architectural Comparison: Variables vs. Data Operations

Architectural FeatureVariablesData Operations
State ModelStateful & Mutable (Values change over time)Stateless & Immutable (Outputs never change once created)
Placement ConstraintsInitialize variable must be at root levelCan be placed anywhere (inside Scopes, Conditions, Loops)
Loop Concurrency SafetyUnsafe in parallel loops; requires Degree of Parallelism = 1Completely thread-safe (stateless)
Performance ProfileSlow when modified repeatedly inside loopsUltra-fast in-memory processing of 5,000+ items in milliseconds
API / Action ConsumptionConsumes 1 action execution per loop iterationConsumes 1 single action execution for the entire dataset
Primary Use CasesCounters, flags, accumulating state across disparate stepsReshaping arrays, generating tables, filtering collections, parsing JSON
Test Your Knowledge

A functional consultant creates a cloud flow that queries 2,000 active contacts from Dataverse. The flow must extract each contact's email address, filter out any contacts where the email is blank, and concatenate the remaining addresses into a single semicolon-delimited string to populate the 'BCC' field of an Outlook send email action. Which combination of actions implements this requirement with the highest performance and lowest action execution count?

A
B
C
D
Test Your Knowledge

A consultant is designing a cloud flow and attempts to add an 'Initialize variable' action inside the 'If yes' branch of a Condition action to create a string variable only when a high-priority incident is detected. The Power Automate flow checker flags an error and prevents saving. What is the cause of this error and how should it be resolved?

A
B
C
D
Test Your Knowledge

An automated cloud flow sends an HTTP request to an external logistics service, receiving a JSON response payload representing package tracking history. The consultant adds a 'Parse JSON' action to make individual tracking fields available as dynamic tokens. During testing, the action fails with a 'BadRequest - Invalid type. Expected String but got Null' error on the 'deliverySignature' field. How should the consultant update the JSON Schema in the Parse JSON action to resolve this failure?

A
B
C
D
Test Your Knowledge

A functional consultant needs to convert an array of JSON objects containing product inventory data into an HTML table for an automated daily digest email. The consultant needs to ensure the table displays user-friendly headers ('SKU Code', 'Unit Price', 'Stock Level') rather than the internal schema names ('cr123_sku', 'cr123_price', 'cr123_qty'). How should the 'Create HTML table' action be configured?

A
B
C
D