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.

View solution in original post

3 REPLIES 3
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.

View solution in original post

Hoffor
Level: Power Up

Re: How do I filter data in Flow?

 
RobWickham
Level: Powered On

Re: How do I filter data in Flow?

how would this work if the class ("1", "2", etc.) was actually the email address of the teacher, and this email address was in the source table being queried? The goal being how to simply iterate over each email address and summarize just those applicable rows into the html table that is sent out in email, and not "hard code" assumptions into the Flow logic about how many classrooms (or email targets) there will be?

 

I'm new, and trying to adapt this post into my similar use case of grabbing a subset of rows from an Excel sheet and emailing them as an html table to the owner (in a single email, not 1 email for each row.) Like a "group by email" expression.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,605)