Search code examples
azure-data-factory

ADF filter transformation


My filter requirement (contains(record.Distribution,#item.code != 'AM')) However, I encountered the issue of the filter returning a document that an array Distributed object with multiple codes in example 2.json. Is that because an array Distribution object has multiple codes? How can I fix the logic not to return 2.json?

For examples:

1.json
{
  "record":{
   "Distribution":[
       "code": "AM",
       "Desc": ""
   ]
  }
}

2.json
{
  "record":{ 
  "Distribution":[
       {
         "code": "XD",
         "Desc": ""
       },
       {
         "code": "AM",
         "Desc": ""
       }
   ]
  }
}

Solution

  • You can use the below expression in the filter transformation to achieve your requirement.

    size(mapIf(record.Distribution,#item.code=='AM',#item))==0
    

    enter image description here

    It will give the expected results as shown below.

    enter image description here