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.


Related Post

Flow: So Where has “Edit in advanced mode... Below is an image of the new format for conditions in Flow. Look at the no code control we have here with real conditional logic. What in improvement ...
PowerShell Office 365: SMTP Email Sent with PowerS... In this example, I have an extremely simple function called MyCode. The purpose of the function is only to demonstrate us taking any PowerShell output...
Harness the Twitter API via flow to capture new tw... In this post, we will now add an additional layer of visibility with the Office 365 Alerts Mailbox by monitoring tweets from @MSFT365Status. Micros...
Call O365 Endpoints Web Service and Return the Lat... Now we will look into an automated process that allows us to call the Office 365 IP Address and URL Web service and to have the news Endpoints returne...