Vizeet Srivastava
Vizeet Srivastava

Reputation: 21

Derive Array of complex type from column values

I need to create ADF workflow such that: input column name "phone" which contains phone number results in below:

contact[0].number = "xxxxxxxxxx"
contact[0].type = "phone"

and "mobile" column results in:

contact[1].number = "xxxxxxxxxx"
contact[1].type = "mobile"

We get "phone" and "mobile" in all the input rows.

The source is Azure SQL Database.

I need to sink this into blob storage in json file.

Please help me solve this issue.

Upvotes: 1

Views: 1090

Answers (2)

Kiran-MSFT
Kiran-MSFT

Reputation: 234

Use the array syntax with 2 structures [@(number = Phone, type = 'Phone'),@(number = Mobile,type = 'Mobile')]

Upvotes: 3

Mark Kromer MSFT
Mark Kromer MSFT

Reputation: 3838

Use a Derived Column in data flows and build your structure inside the expression builder. Call your top-level structure "contacts". Now use an Aggregate transformation to create an array of your rows of structs using the collect() function. Here are some examples:

https://www.youtube.com/watch?v=zneE18EHJSE https://www.youtube.com/watch?v=oAEh21NFgWQ

Upvotes: 0

Related Questions