Flow: Filter Array on Multiple Parameters Using and()

Back in part 8 – Call O365 Roadmap Web Service Weekly Digest you will see there is a Filter Array that I left alone at that time. This is because the scope of the blog post was to get a weekly digest of posts made by the Microsoft 365 Roadmap.

The expression within the Filter Array get's you the last 7 days of updates and does no more.

This is great, unless of course you have no need to be viewing a specific category such as Windows or O365. Maybe you are an Office 365 Admin and would like to streamline the output by only sending those with category of O365. Or maybe you need to see all Security & Compliance updates along with O365 and the rest, so you would need to omit posts with category Windows Desktop.  Here are steps that you can take to modify the above Filter Array and why.

Consider this filter …

@and(not(contains(item()?['categories'], 'Windows Desktop')), greater(item()?['publishDate'], adddays(utcnow(), -7)))

I have added use of @and(not(contains(item()?['categories'], 'Windows Desktop')), <next expression> )

and – allows multiple conditions to filter on

contains – asks if the value has 'Windows Desktop' in it

not – The value does not contain 'Windows Desktop' in it

Note: You can view all functions at the Functions reference for Workflow Definition Language.

Be aware, the best way to look at filtering your array is to look at the output of a previous run or previous test. Mines looks like the below:

    "id": "44212",
    "title": "SharePoint organizational news: ordering of news articles",
    "primaryLink": "https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/What-s-new-for-your-intranet-in-Office-365/ba-p/194168",
    "links": [
    "updatedOn": "2018-12-07 23:21:46Z",
    "publishDate": "2018-11-20 18:46:50Z",
    "summary": "Within the News web part for SharePoint sites, there will be a new capability to decide what order the news appears in when viewers land on the page highlighting news articles. Now you will be able to highlight high-value content more easily knowing it is most and/or first visible among the breadth of news being published within a site.",
    "copyright": "",
    "categories": [
      "In development",

You will see a typical example of categories above has multiple values. None of which are 'Windows Desktop'.

You can investigate the output more in this example by visiting Code Beautify and loading the Microsoft 365 Roadmapp RSS feed.


Do you need assistance building this Flow?

Visit the Get Help section of the Power Automate Community