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:

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.

Alan