Suren Sivalingam
Suren Sivalingam

Reputation: 23

How to use space for the Item value inside Foreach of Azure Data Factory?

I have "Foreach" which output following Items:
"Factory Code": "XXXX",
"Factory Name": "XXXXXXXXXX",
"ERP Reference": "XXX",

It has items with spaces, I tried to get the item in the dynamic content with @{item().Factory Code}
However this is not possible as I have space in-between Factory and Code, I can't change the source system. how can I resolve this issue?

See below for the source data send it to foreach

{
    "count": 527,
    "value": [
        {
            "Factory Code": "xxxx",
            "Factory Name": "xxxxx",
            "ERP Reference": "xxxx",
            "Factory Country": "xxxxx",

Upvotes: 0

Views: 792

Answers (1)

Rakesh Govindula
Rakesh Govindula

Reputation: 11234

You can do it by giving the dynamic content as @item()['Factory Code'] inside ForEach.

Follow the below demonstration:

My sample json passed to ForEach using lookup:

[
    {
    "Factory Code": "Code1",
    "Factory Name": "XXXXXXXXXX1",
    "ERP Reference": "XXX1"
    },
    {
    "Factory Code": "Code2",
    "Factory Name": "XXXXXXXXXX2",
    "ERP Reference": "XXX2"
    },
    {
    "Factory Code": "Code3",
    "Factory Name": "XXXXXXXXXX3",
    "ERP Reference": "XXX3"
    }
]

enter image description here
Inside ForEach I have used append variable activity to store the Factory Code values.

enter image description here

Result stored in a variable after ForEach:
enter image description here

Upvotes: 1

Related Questions