expressionazure-data-factorylookupforeach-loop-container

Azure Data Factory expression evaluation failes


Pipeline piece

In the ForEach loop i have a "set variable" object where i want to catch the value from each Identifier.

The output from the Lookup looks like:

{
    "count": 60,
    "value": [
        {
            "Identifier": "83667NED"
        },
        {
            "Identifier": "83668NED"
        },
        {
            "Identifier": "60006"
        },
        {
            "Identifier": "37823wkk"
        },
        {
            "Identifier": "60006eng"
        },
        {
            "Identifier": "37823eng"
        },
        {
            "Identifier": "84046ENG"
        },
        {
            "Identifier": "84046NED"
        }
]

My used expression:

@activity('LU_max_values').output.value[item().Identifier]

I need the value of the key Identifier in each loop to be set in my variable but i get the error:

The expression 'activity('LU_max_values').output.value[item().Identifier]' cannot be evaluated because property '84472ENG' cannot be selected. Array elements can only be selected using an integer index.

When i use the expression:

@activity('LU_max_values').output.value[item()].Identifier

the next error is raised

The expression 'activity('LU_max_values').output.value[item()].Identifier' cannot be evaluated because property '{ "Identifier": "84037NED" }' cannot be selected.

what goes wrong?


Solution

  • There are two things that you need to check:

    1. The Items section in your For Each should be more like this:

      @activity('LU_max_values').output.value
      
    2. When accessing that item with the For Each loop should be more like this:

      @item().Identifier
      

    Sample pipeline:

    Sample pipeline