ARRAY index problem. Array can only be selected using an integer index

DannyV-2978 6 Reputation points
2020-12-01T02:14:13.44+00:00

Hi, I am trying to pass a file name to a store procedure from a lookup into a ForEach.

43846-image.png

But I am getting the following error
The expression 'activity('LookupRes').output.value[variables('i')]' cannot be evaluated because property '4' cannot be selected. Array elements can only be selected using an integer index.

in my SP I have an expression as
@activity('LookupRes').output.value[variables('i')]

43941-image.png

Increment J = @ hide (add(int(variables('i')), 1))

Set I = @variables('j')

That is how I am trying to get the index for my lookup
@activity('LookupRes').output.value[variables('i')]

But its not working.

Any suggestions?

Thanks

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,681 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,816 Reputation points Microsoft Employee
    2020-12-09T16:53:23.007+00:00

    @Anonymous Thanks for using Microsoft Q&A.
    Have you defined the variable "i" as a string ? Please try casting your variable to int in your activity e.g. @activity('LookupRes').output.value[int(variables('i'))].

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.