sharepointpower-automateoffice365-apps

Power Automate FIlter Array with Array Object as Attribute


i have a Object-Array1 with some Attributes that are Object-Array2. I want to filter my Object-Array1 only to these elements, that contain a special value in Object-Array2. How wo i do this? Example:

{
  "value": [
    {
      "title": "aaa",
      "ID": 1,
      "Responsible": [
        {
          "EMail": "abc@def.de",
          "Id": 1756,
        },
        {
          "EMail: "xyz@xyz.com",
          "Id": 289,
        }
      ]
    },
    
    {
      "title": "bbbb",
      "ID": 2,
      "Responsible": [
        {
          "EMail": "tzu@iop.de",
          "Id": 1756,
        }
      ]
    }
]
}

I want to filter my Object-Array1 (with title & id) only to these elements, that contain abc@def.de

How do i do this in Power Automate with the "Filter Array" Object? I tried this way, but didn't work: Text


Solution

  • Firstly, you haven't entered an expression, you've entered text. That will never work.

    Secondly, even if you did set that as an expression, I don't think you'll be able to make it work over an array, at least, not without specifying more properties and making it a little more complex.

    I think the easiest way is to use a contains statement after turning the item into a string ...

    Flow

    The expression I am using on the left hand side is ...

    string(item()?['Responsible'])
    

    ... and this is the result ...

    Result