GM3
GM3

Reputation: 63

ADF v2 - Web Activity- POST output not retrievable

With Azure Data Factory v2, I created Web Activity using the POST method and got the desired response output. But can't get the rows data from the output response in the next activity.

How do I reference columns in the rows in this output? The data in the rows doesn't have any headers.

{
"Tables": [
    {
        "TableName": "Table_0",
        "Columns": [
            {
                "ColumnName": "MyFieldA",
                "DataType": "String",
                "ColumnType": "string"
            },
            {
                "ColumnName": "MyFieldB",
                "DataType": "String",
                "ColumnType": "string"
            }
        ],
        "Rows": [
            [
                "ABCDEF",
                "AAAABBBBBCCCDDDDD"
            ],
            [
                "CCCCCCC",
                "CCCCCCC"
            ],

I can't reference the value in the rows I've tried numerous things e.g. @activity('WebActivity').output.Rows

Nothing seems to work. What's the point of getting a response from a web activity and then not being able to reference the output in data factory?

Upvotes: 0

Views: 437

Answers (2)

GM3
GM3

Reputation: 63

Thanks Pacodel!!! You've helped me out. And to use in the a For Each Loop and Array, when I pass in the Rows to my Execute pipeline activity @activity('WebActivity').output.Tables[0].Rows:

[
   [
    "ABCDEF",
    "AAAABBBBBCCCDDDDD"
   ],
   [
    "CCCCCCC",
    "CCCCCCC"
   ]
]

I can use the following to reference the rows:

@{item()[0]}
@{item()[1]}

I use the @item to populate parameters in a stored procedure activity which loads my table

Thanks

Upvotes: 1

Pacodel
Pacodel

Reputation: 176

For your example.

@activity('WebActivity').output.Tables[0].Rows will return the following:

[
    [
        "ABCDEF",
        "AAAABBBBBCCCDDDDD"
    ],
    [
        "CCCCCCC",
        "CCCCCCC"
    ]
]

If you want to access even deeper, you just need to specify the index. @activity('WebActivity').output.Tables[0].Rows[0][0] will return ABCDEF

If you need to automate this, you can have a pattern of foreach with an execute pipeline inside passing an array as a parameter until you get to the properties that you need.

Upvotes: 0

Related Questions