Blogindlæg

Power Automate Desktop: Beginner’s Guide to 'Set Variable' Syntax

New to Power Automate Desktop (PAD)? This guide walks through the essential syntax you’ll use in the 'Set variable' action. Keep it nearby as a quick reference while you build flows.

Udgivet: 2025-08-14

Power Automate Desktop: Beginner’s Guide to 'Set Variable' Syntax

Two tiny rules that unlock everything

  • Variables are referenced with percent signs: %MyVariable%
  • Text does not use quotes (unless encapsulated by two percentage signs (%))

1) Strings (text)

Pepe Consulting
Order #12345
Today is %CurrentDateTime%

2) Lists (arrays)

Lists are comma-separated values in square brackets. Use zero-based indexes to read items.

%[ 'Value1', 'Value2', 'Value3' ]%
%MyList[1]%

3) Data tables

Create tiny demo tables inline or use Excel/CSV actions to produce them. Access values with a row index and column name. Create headers by applying ^ before the first row.

%{ ['Alice', 30], ['Bob', 28] }%
%People[0]['Name']%
%{ ^['Name','Age'], ['Alice', 30], ['Bob', 28] }%

4) Data rows

A data row represents one row from a table. When looping a table, each %CurrentItem% is a row. Extract values by using the column name.

%Row['Age']%

5) Custom objects

Custom objects are name/value pairs wrapped in curly braces. They’re great for grouping related values into a single variable. Empty custom objects can be created used double curly brackets.

%{ 'FirstName': 'Alice', 'LastName': 'Smith', 'Age': 30 }%
%Person['FirstName']%
% { { } } %

In this example, %Person% is a custom object with three properties. Access them using the property name inside brackets: %Person['LastName']% → Smith.

Worked example

Glue it together in three steps:

  1. Set NameList → %[ 'Alice', 'Bob', 'Cara' ]%
  2. Set People → %{ ^['Name','Age'], ['Alice',30], ['Bob',28], ['Cara',33] }%
  3. Display message → First person is %NameList[0]%. Age: %People[0]['Age']%

Frequently used expressions

  • %List[0]% - first item
  • %Table[0]['Name']% - value by row index and column name
  • Text %Var% - concatenate text with a variable
  • %Object['Key']% - read a property from a custom object

Troubleshooting checklist

  • Index errors? Lists start at 0
  • “Column not found”? Match the exact column name (including spaces)
  • Custom object property missing? Double-check spelling and quotes