Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hello,
I have a JSON file with this structure from a CopyData activity step in my Data Factory pipeline:
"value": [{
"id": "123",
"isReadOnly": false,
//additional key-values
}, {
"id": "1234",
"isReadOnly": false,
//additional key-values
}, {
"id": "12345",
"isReadOnly": false,
//additional key-values
},
I want to extract all the 'ids' and turn them into an array so that I can iterate over them in a ForEach activity in Data Factory ex. ["123","1234","12345"]. How do I accomplish this?
I am very new to Data Factory so thank you for any other suggestions regarding using the ForEach to iterate over all the ids. As well, if you are able, the more detail the better. Thank you!
Solved! Go to Solution.
Hey,
The output Value is by default an Array.
You can iterate over the Copy activity output directly via For each and get the ID details per iteration itself.
where parameter Test value is :
[{ "id": "123", "isReadOnly": false }, { "id": "1234", "isReadOnly": false }]
You can use For each activity to iterate over the value directly
within for each, use Set variable activity to get the ID value
Output :
Hey,
The Parameter is just an example for demonstration purpose.
If the file size is less, you can use lookup activity to read the file and use that lokup value inplace of parameter
Hey,
The output Value is by default an Array.
You can iterate over the Copy activity output directly via For each and get the ID details per iteration itself.
where parameter Test value is :
[{ "id": "123", "isReadOnly": false }, { "id": "1234", "isReadOnly": false }]
You can use For each activity to iterate over the value directly
within for each, use Set variable activity to get the ID value
Output :
Thank you for answering my question, but how do I make the Default Value in the Parameters my Id key from my JSON file? In your example, it looks like the JSON file has been copy pasted into default value but since I'm creating a new JSON file everytime I run copy data, how would I make sure that that new JSON file is always used?
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.