Hi Kai Sor ,
Thankyou for using Microsoft Q&A platform and thanks for posting your query here.
As per my understanding you are trying to reference foreach activity item within Copy activity which is present inside the If block within Foreach activity.
As mentioned in the error , you can't refer to the foreach activity output value as it is not direct ancestor to the copy activity. However, you can still make use of the expression using item function :
@{item()}
or@{item().tablename}
to refer within copy activity.
Simply, remove the expression @activity('Foreach1')
and try @item()
. It should work.
Hope it helps. Kindly accept the answer by clicking on Accept answer
button. Thankyou