Reputation: 1707
I have a Get Metadata activity which get all child items under a blob container. There are both files and folders but i just need files. So in a filter activity which filter for only items of type = file. This is what I got from the filter activity:
Output
{
"ItemsCount": 4,
"FilteredItemsCount": 3,
"Value": [
{
"name": "BRAND MAPPING.csv",
"type": "File"
},
{
"name": "ChinaBIHRA.csv",
"type": "File"
},
{
"name": "ChinaBIHRA.csv_20201021121500",
"type": "File"
}
]
}
So there is an array of 3 objects being returned. Each object has a name and type properties. I want just the names to be fed to a store procedure activity as a parameter. I have used this expression to try to get a comma separated list as the parameter.
@join(activity('Filter1').output.Value.name, ',')
and got this error:
The expression 'join(activity('Filter1').output.Value.name, ',')' cannot be evaluated because property 'name' cannot be selected. Array elements can only be selected using an integer index.
So how can I achieve this?
Upvotes: 0
Views: 7017
Reputation: 21
Use the below codeblock instead
@concat(
''''
,join(
json(
replace(
replace(
replace(
replace(
string(activity('Filter1').output.Value)
,',"type":"File"'
,''
)
,'"name":'
,''
)
,'{'
,''
)
,'}'
,''
)
)
,'''
,'''
)
,''''
)
This would forego the use of multiple activities, and you can use the existing framework that you have.
Upvotes: 1
Reputation: 8690
You can create For Each activity after Filter activity. Within For Each activity, append file name.
Step:
2.Setting of For Each activity
3.Setting of Append Variable activity within For Each activity
Upvotes: 1