Append an array column in mapping data flow's derived column transformation in ADF

SARASWAT CHETAN 91 Reputation points
2021-03-13T07:50:28.94+00:00

I have an existing array of multiple JSON objects coming out of a select transformation and I have to append all the objects within that array with some more "default" key-value" pairs(string type) using a derived column.

Could anyone suggest any possible way of doing these. I have tried using below to get all the items(json based objects) from the array, but not able to add more key-value pairs to each objects.

![77394-image.png]1

Note the four fields below "devicearray" are the one's which are to added to the array of objects.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,437 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,483 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kiran-MSFT 691 Reputation points Microsoft Employee
    2021-03-15T05:56:27.503+00:00

    map(userdevices.devices, @(
    each(#item, match(true), $$),
    createdtime = currentDate(),
    isActive = true
    )
    )

    If the UI does not validate this, instead of each(#item, match(true), $$), you have to specify every item

    like
    deviceId = #item.deviceId,
    deviceName = #item.deviceName
    ...


2 additional answers

Sort by: Most helpful
  1. Kiran-MSFT 691 Reputation points Microsoft Employee
    2021-03-15T01:17:12.3+00:00

    You can just do arr1 + arr2 if there are of the same type


  2. Kiran-MSFT 691 Reputation points Microsoft Employee
    2021-03-15T05:38:24.29+00:00

    What does your DSL script look like(click on script button)?