cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
mr-dang
Level 10

How do I filter data in Flow?

Use case: students earn classroom money. Their transactions are recorded in one table, and another table called 'Bank' calculates a total balance. I am able to send out an email with a summary of everyone's balances (see image below).

 

2018-03-05 (3).png

 

My steps:

  1. Get rows from the table.
  2. Select relevant data: name, balance, class.
  3. Create an HTML table.
  4. Send an email with that HTML table. It works.

Problem: I want to filter the students based on their classroom, then email each teacher only data for their class. Currently I can only send out the whole thing as I'm testing out the Flow.

 

I tried the filter data operation two ways:

  • I tried filtering the result from the Get in step 1. The result can be used as the input for step 2, but its columns can't be referenced in later steps.
  • I tried filtering the result from the Select in step 2. The output from Select can be the input for the Filter, but its columns can't be referenced in the filter.

 

Questions:

  • How do I filter data in a Flow?
  • Which step do I try to filter data?

 

I imagine I could execute more of the filter from within PowerApps, but I would like to shift this operation to a recurrence so that it is automated.

 

Any help is appreciated.

 

_

Microsoft Employee
@8bitclassroom
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How do I filter data in Flow?

Hi @mr-dang,

 

Could you please share a full screenshot of your flow's configuration?

Could you please show a bit more about your Google Excel table?

Further, do you want to filter records based on classroom?

 

I have created a Google Excel table on my side and the data structure of it as below:5.JPG

 

I assume that you want to filter records whose Class is equal to 1, please take a try with the following workaround:

  • Add a "Recurrence" trigger, Interval set to 1 and Frequency set to Day.
  • Add a "Get rows" action, specify File and Worksheet.
  • Add a "Filter array" action, From set to output of "Get rows" action, within Condition box, click "Edit in advanced mode", type the following formula:
@equals(item()?['Class'], '1')
  • Add a "Select" action, From set to output of "Filter array" action, Within Map entry, type there entries. The key of first entry set to Student Name and the corresponding value set to following formula:
item()?['Student_x0020_Name']

The key of second entry set to Current Balance and the corresponding value set to following formula:

item()?['Current_x0020_Balance']

The key of third entry set to Class and the corresponding value set to following formula:

item()?['Class']

Note: The Student Name, Current Balance and Class are columns in my Google sheet, on your side, you could get the column value within your Google sheet with following formula:

item()?['ColumnNameInYourGoogleSheet']

If there is a space within the column name, you must replace the space with '_x0020_' within above formula (WDL expression).

 

  • Add a "Create HTML table" action, From set to output of "Select" action, Include Headers set to Yes.
  • Add a "Send an email" action, Body field set to output of "Create HTML table" action, is HTML field set to Yes.

Image reference:6.JPG

 

7.JPG

 

The flow works successfully as below:8.JPG

 

9.JPG

 

 

More details about using expression in flow actions, please check the following article:

https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: How do I filter data in Flow?

Hi @mr-dang,

 

Could you please share a full screenshot of your flow's configuration?

Could you please show a bit more about your Google Excel table?

Further, do you want to filter records based on classroom?

 

I have created a Google Excel table on my side and the data structure of it as below:5.JPG

 

I assume that you want to filter records whose Class is equal to 1, please take a try with the following workaround:

  • Add a "Recurrence" trigger, Interval set to 1 and Frequency set to Day.
  • Add a "Get rows" action, specify File and Worksheet.
  • Add a "Filter array" action, From set to output of "Get rows" action, within Condition box, click "Edit in advanced mode", type the following formula:
@equals(item()?['Class'], '1')
  • Add a "Select" action, From set to output of "Filter array" action, Within Map entry, type there entries. The key of first entry set to Student Name and the corresponding value set to following formula:
item()?['Student_x0020_Name']

The key of second entry set to Current Balance and the corresponding value set to following formula:

item()?['Current_x0020_Balance']

The key of third entry set to Class and the corresponding value set to following formula:

item()?['Class']

Note: The Student Name, Current Balance and Class are columns in my Google sheet, on your side, you could get the column value within your Google sheet with following formula:

item()?['ColumnNameInYourGoogleSheet']

If there is a space within the column name, you must replace the space with '_x0020_' within above formula (WDL expression).

 

  • Add a "Create HTML table" action, From set to output of "Select" action, Include Headers set to Yes.
  • Add a "Send an email" action, Body field set to output of "Create HTML table" action, is HTML field set to Yes.

Image reference:6.JPG

 

7.JPG

 

The flow works successfully as below:8.JPG

 

9.JPG

 

 

More details about using expression in flow actions, please check the following article:

https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hoffor
Level: Power Up

Re: How do I filter data in Flow?

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 217 members 4,736 guests
Please welcome our newest community members: