I get a list of files in folder with get metadata activity, then the files are sorted out with the help of filter activity. Now I want to pass the names of these files to copy activity.
Here is the output of filter activity (There is only one file because it is within for each activity.):
{
"ItemsCount": 2,
"FilteredItemsCount": 1,
"Value": [
{
"name": "part-00000-622d6021-26bc-4ad5-9e4c-0d80cec7c6b7-c000.csv",
"type": "File"
}
]
}
How can I pass the name to copy activity on the source side?
For example, I have already tried: @activity('Filter1_copy1').output.value - @activity('Filter1_copy1').output.value[0]
Everything I have tried leads me to error:
ErrorCode=UserErrorInvalidValueInPayload,'Type=Microsoft.DataTransfer.Common.Shared.HybridDelivery
Exception,Message=Failed to convert the value in 'fileName' property to 'System.String' type.
Please make sure the payload structure and value are correct.,Source=Microsoft.DataTransfer.DataContracts,
''Type=System.InvalidCastException,Message=Object must implement IConvertible.,Source=mscorlib,'
CodePudding user response:
The Azure Data Factory (ADF) expression language is not the most intuitive thing in the world, but there is a strong central element which is really just JSONPath, like XPath, the simple language to interrogate complex JSON objects. This uses a dot syntax to access properties ( eg parent.child
) and an array syntax to access arrays Values[0].name
.
I don't think ADF supports the full JSONPath syntax but I just pasted in your sample JSON, and wrote the Values[0].name
bit to test.