In DataFactory, I’m creating a ForEach activity and in Items I’m using this expression:
@createArray(json('{
"daily": {
"raw": [
{
"entity_name": "ent1",
"fetchXML_file": "raw/ent1.xml",
"destination_path_base": "/master/raw/ent1"
},
{
"entity_name": "ent2",
"fetchXML_file": "raw/ent2.xml",
"destination_path_base": "/master/raw/ent2"
},
{
"entity_name": "ent3",
"fetchXML_file": "raw/ent3.xml",
"destination_path_base": "/master/raw/ent3"
}
]
}
}
'))
and I want to use fetchXML_file values but it doesn’t work.
If I put this: @item().daily.raw[0].fetchXML_file
it will work just for ent1, but I want to use all the values (ent1, ent2 and ent3)
I wanted to achieve this method, because it is "cleaner" than creating parameters and then modifying the json or adding more things to the json.
Can anyone help to achieve this ?
Thanks a lot!
2
Answers
You are indexing to 0 at raw array so it only takes the first element. If you remove the index it should work.
To pass items to For Each activity It should be in array format. your
create Array
andJson
function converting object to array and it not iterating over the raw– array.To achieve this follow below steps:
Array type
variable to store the raw array with value@item().daily.raw
Output of it:
@variables('demo')
fetchXML_file
Output: