1

Context :

  • Inside Azure Data Factory, I have a pipeline which contains a "Foreach" activity.
  • I'm trying to write an expression for its "Items" setting.

In the expression builder, I have entered this :

@if(not(empty(activity('GetReplies').output.resultSets)), activity('GetReplies').output.resultSets[0].rows, array([]))

To make it more readable for you, I'm breaking it into several lines here (but not in the expression builder) :

@if(
   //condition
   not(empty(activity('GetReplies').output.resultSets)),
   //true
   activity('GetReplies').output.resultSets[0].rows, 
   //false
   array([])
)

Note: The idea is to check if activity "GetReplies" produced a set of items. If yes, return it. If not, return an empty array.

There is no error highlighted in the expression builder. The pipeline gets saved, validated, published.

Problem : When I run the pipeline, I get an error "Unable to parse" on this expression.

enter image description here

Troubleshooting : I've tried with the simplest possible expression I could find to generate a set of items :

@array([])

...It still complains that the expression can't be parsed... (same error message)

What's the issue there???

jeancallisti
  • 1,046
  • 1
  • 11
  • 21

1 Answers1

0

There were two kinds of answers in there:

  1. Be very careful with unwanted carriage returns. For example if your expression builder contains this : enter image description here

...then it's not correct because of the carriage return before the leading '@'

  1. Some typing problems are not caught, and later deemed "parse errors" at runtime, which is misleading. Note: In this case, it was the use of array([]) because function array is not supposed to take an array but a single value in parameter.

Replacing array([]) with json("[]") fixed the issue.

jeancallisti
  • 1,046
  • 1
  • 11
  • 21