When you need this
A pipeline fails with The expression '...' cannot be evaluated, or a copy runs against the wrong folder or date. Most of the time the cause is a single line of dynamic content. This page has the expressions you use most and a short list of the errors they cause.
Azure Data Factory, Synapse pipelines and Fabric pipelines all use the same expression language. The UI around it differs a little.
Syntax rules that trip people up
| Rule | Example |
|---|---|
A value that starts with @ is evaluated as an expression | @pipeline().parameters.folder |
Use @{...} to put an expression inside a string | raw/@{pipeline().parameters.folder}/data.csv |
Write @@ for a literal @ at the start of a value | @@example → @example |
| String literals take single quotes. Double a quote to escape it | @concat('it''s', ' ok') |
| Property names are case-sensitive in JSON outputs | firstRow.CustomerId is not the same as firstRow.customerid |
? returns null instead of failing on a missing property | @activity('Lookup1').output?.firstRow?.wm |
Tip
A whole expression (
@concat(...)) returns its real type, such as an array, int or bool. Interpolation ("@{...}") always returns a string. If a ForEach complains that its items are not an array, check that the setting doesn't contain@{...}wrapped in text.
System variables
@pipeline().DataFactory name of the factory or workspace
@pipeline().Pipeline pipeline name
@pipeline().RunId run ID of this pipeline run
@pipeline().TriggerType Manual, ScheduleTrigger, TumblingWindowTrigger, ...
@pipeline().TriggerName
@pipeline().TriggerTime when the trigger fired (UTC)
@pipeline().GroupId groups the runs of one rerun
@pipeline()?.TriggeredByPipelineRunId parent run ID when started by Execute Pipeline
@pipeline().globalParameters.env global parameter (ADF/Synapse)
Trigger-scoped values. Set these on the trigger and pass them into pipeline parameters:
@trigger().scheduledTime schedule trigger: planned fire time
@trigger().startTime schedule trigger: actual fire time
@trigger().outputs.windowStartTime tumbling window start
@trigger().outputs.windowEndTime tumbling window end
@triggerBody().folderPath storage event trigger
@triggerBody().fileName storage event trigger
Warning
@trigger()only works in trigger parameter mappings. You can't use it inside pipeline activities. Map it to a pipeline parameter such aswindowStartand read@pipeline().parameters.windowStartfrom the activities.
Parameters and variables
@pipeline().parameters.sourceTable
@dataset().fileName inside a dataset, its own parameter
@linkedService().dbName inside a linked service, its own parameter
@variables('rowCount')
@item() current element inside ForEach
@item().tableName property of the current element
Variables accept String, Boolean and Array. Newer builds add more types, so check what your Set Variable activity offers. A Set Variable activity can't reference the variable it sets. To append, use Append Variable for arrays. For strings, set a temporary variable and copy it back.
Activity outputs
| Activity | Expression | Gives you |
|---|---|---|
| Lookup (first row only) | @activity('Lookup1').output.firstRow.maxDate | One column value |
| Lookup (all rows) | @activity('Lookup1').output.value | Array of rows for ForEach |
| Lookup (all rows) | @activity('Lookup1').output.count | Number of rows returned |
| Copy | @activity('Copy1').output.rowsCopied | Rows written |
| Copy | @activity('Copy1').output.rowsRead | Rows read |
| Copy | @activity('Copy1').output.dataWritten | Bytes written |
| Get Metadata | @activity('GetMeta1').output.childItems | Array of {name, type} |
| Get Metadata | @activity('GetMeta1').output.exists | true/false (needs the Exists field selected) |
| Get Metadata | @activity('GetMeta1').output.lastModified | Last modified timestamp |
| Web / Azure Function | @activity('Web1').output.<property> | Parsed JSON body |
| Notebook (Databricks) | @activity('Nb1').output.runOutput | Value passed to dbutils.notebook.exit() |
| Any, on the failure path | @activity('Copy1').error.message | The error text, for alerts |
Get Metadata only returns the fields you select in Field list. If childItems is missing from the output, it wasn't selected.
Dates and times
All functions work in UTC unless you convert.
@utcnow() 2026-11-16T09:15:02.1234567Z
@utcnow('yyyy-MM-dd') 2026-11-16
@formatDateTime(utcnow(), 'yyyy/MM/dd/HH') 2026/11/16/09
@addDays(utcnow(), -1, 'yyyy-MM-dd') yesterday
@addHours(utcnow(), -2)
@startOfDay(utcnow()) 2026-11-16T00:00:00.0000000Z
@startOfMonth(utcnow(), 'yyyy-MM-dd') 2026-11-01
@getPastTime(7, 'Day', 'yyyy-MM-dd')
@convertFromUtc(utcnow(), 'India Standard Time', 'yyyy-MM-dd HH:mm')
@dayOfWeek(utcnow()) 0 = Sunday
@formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-dd')
Partitioned folder paths from a tumbling window:
raw/sales/@{formatDateTime(pipeline().parameters.windowStart,'yyyy')}/@{formatDateTime(pipeline().parameters.windowStart,'MM')}/@{formatDateTime(pipeline().parameters.windowStart,'dd')}
Caution
Don't build reload folders from
utcnow(). If you rerun yesterday's failed run today, it reads and writes today's folder, and you can overwrite good data. Use the trigger window or@pipeline().TriggerTimepassed in as a parameter, because a rerun keeps the original values.
Strings, logic and conversion
@concat('stg_', pipeline().parameters.table)
@toLower(item().name)
@replace(item().name, '.csv', '')
@split(item().name, '_')[0]
@last(split(pipeline().parameters.path, '/'))
@substring('20261116', 0, 4)
@contains(item().name, '.parquet')
@startsWith(item().name, 'sales_')
@if(equals(pipeline().parameters.env, 'prod'), 'prd-sql', 'dev-sql')
@and(greater(activity('Lookup1').output.count, 0), not(empty(pipeline().parameters.table)))
@coalesce(pipeline().parameters.watermark, '1900-01-01')
@int(activity('Lookup1').output.firstRow.cnt)
@string(activity('Copy1').output.rowsCopied)
@json(pipeline().parameters.configJson)
@createArray('a', 'b', 'c')
@length(activity('GetMeta1').output.childItems)
@guid()
Filter activity on Get Metadata output, keeping only CSV files:
Items: @activity('GetMeta1').output.childItems
Condition: @and(equals(item().type, 'File'), endsWith(item().name, '.csv'))
Then loop over @activity('Filter1').output.value in the ForEach.
Dynamic SQL in Lookup and Copy
SELECT * FROM @{pipeline().parameters.schema}.@{pipeline().parameters.table}
WHERE ModifiedDate > '@{activity('GetWatermark').output.firstRow.wm}'
AND ModifiedDate <= '@{pipeline().parameters.windowEnd}'
Warning
Interpolated SQL is string concatenation. Only pass values your team controls, such as table names from a config table. Never pass free text from a web call or file content.
See what an expression actually resolved to
- In Monitor, open the run, select the activity and view Input. It shows the resolved values, not the expression.
- To test a single expression while debugging, add a Set Variable activity with the expression and run Debug.
- From the CLI, list the activity runs and their inputs:
az datafactory activity-run query-by-pipeline-run \
--resource-group rg-data --factory-name adf-prod \
--run-id <pipelineRunId> \
--last-updated-after 2026-11-15T00:00:00Z \
--last-updated-before 2026-11-17T00:00:00Z \
--query "value[].{name:activityName, status:status, input:input, error:error.message}"
Start a run with parameters to test a fix:
az datafactory pipeline create-run \
--resource-group rg-data --factory-name adf-prod --name pl_load_sales \
--parameters '{"windowStart":"2026-11-15T00:00:00Z","windowEnd":"2026-11-16T00:00:00Z"}'
The az datafactory commands come from the datafactory CLI extension. Run az extension add --name datafactory if they're missing.
Common errors
Error text varies a little between ADF, Synapse and Fabric.
| Error | Cause | Fix |
|---|---|---|
property 'firstRow' doesn't exist | Lookup returned no rows, or First row only is off | Use output?.firstRow?.col with coalesce, or check output.count first |
property 'value' doesn't exist | First row only is on, but you read .value | Turn it off, or read firstRow |
The function 'int' was invoked with a parameter that is not valid | Null or non-numeric string | Wrap the value in coalesce(..., '0') and check the source column |
Unable to parse expression / Position N | Unbalanced quotes or brackets, or a " used instead of ' | Count the brackets. Use single quotes inside expressions |
ForEach: items is not an array | Expression wrapped in @{...} text, or a Lookup with First row only on | Use a whole @... expression that returns an array |
Activity 'X' not found | Activity renamed, or referenced from outside its scope | Activity names are exact. Inside ForEach you can only reference activities that run before it or inside the same loop iteration |
| Wrong folder on rerun | Path built from utcnow() | Use trigger window parameters |
| Timestamp off by hours | Mixed UTC and local time | Keep everything in UTC and convert only for display with convertFromUtc |
Prevent it next time
- Pass trigger times into parameters and build every path and filter from them. Avoid
utcnow(). - Use
?andcoalescewherever a Lookup can return nothing. - Keep the table names and column lists that drive ForEach loops in a config table, not hard-coded in expressions.
- After any change to an expression, run Debug and check the activity Input before you publish.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get