cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chrisguff12
Resolver I
Resolver I

Emailing a data table along with its filters

Hello,

In my last post I got my tables and filters working and accepted the solution forgetting my last part about sending an email. For reference here is my pervious post about setting up my table and filters.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Screen-with-multiple-reports-with-filters-an...

 

For the emailing a Table:

I have a data table that can be filtered by a dropdown with three date options. I need to setup an email button that will only email the displayed results in the table after the filter has been selected.

 

 The three date filters are ["This Week", "This Month", "Year to Date"]

The tables Items Property is:

Switch(
   'Date_Filter_VH-C_Dropdown'.Selected.Value,
   "This Week",
   Filter(Etcher_Cleaning_Sheet,'Date and Time'>=DateAdd(Today(),If(Weekday(Today())<>1,-Weekday(Today())+2,-6),Days) && 'Date and Time'<DateAdd(Today(),If(Weekday(Today())<>1,9-Weekday(Today()),0),Days)),
   "This Month",
   Filter(Etcher_Cleaning_Sheet,Year('Date and Time')=Year(Today()) && Month('Date and Time')=Month(Today())),
   "Year to Date",
   Filter(Etcher_Cleaning_Sheet,Year('Date and Time')=Year(Today())),
   Etcher_Cleaning_Sheet
)

 

Thank You.

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Chrisguff12 :

Step1: To get the Schema, you must first get the JSON of your table

There is a very intuitive method: I have used this formula "Set(TheTable,JSON(QQQ));" to store the JSON of the target Table in the variable TheTable. You only need to add a label and set its Text property to TheTable to get the JSON of the target table.

Step2: Click ‘Generate from sample’ to automatically get the JSON schema

1.JPG

I think this link will help you a lot:

How to Parse JSON in Microsoft Power Automate 

Best Regards,

Bof

 

 

 

 

 

View solution in original post

Hi,  @v-bofeng-msft 

 

So, I have been messing around with the solutions that you provided and somehow I stumbled into the system working even thou it’s still a little different from what you showed me. A lot of the options in the flow that you suggested and that were in the link you provided were different from what I was seeing.

 

Anyway, here is what my Flow looks like:

Chrisguff12_3-1613617446163.png

 

And the result I get is this:

Chrisguff12_5-1613617600173.png

 

Thanks for all you help.

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @Chrisguff12 :

Do you want to email the filtered table to the specified user?

If so,I'm afraid this is a bit difficult.The key is that you need to convert the table into HTML format, but PowerApps does not provide this feature. My suggestion is to insert a flow.I've made a test for your reference:

1\My data table:

ClearCollect(QQQ,{ID:1,ColumnA:"1",ColumnB:"2"},{ID:2,ColumnA:"1",ColumnB:"3"},{ID:3,ColumnA:"2",ColumnB:"2"},{ID:4,ColumnA:"1",ColumnB:"2"})

2\Create a flow('PowerApp->ParseJSON,CreateHTMLtable,Sendanemail(V2)')

1.JPG

Note:the Schema parameter is depends on the schema of your data source.If you don't know what it is, you can automatically generate it by clicking ‘Generate from sample’ and entering the JSON of your table.

3\Insert this flow into your app

2.JPG

4\Add a button and set it's OnSelect property to

Set(TheTable,JSON(QQQ));
'PowerApp->ParseJSON,CreateHTMLtable,Sendanemail(V2)'.Run(TheTable)

On your side the code should be

Set(TheTable,JSON(Switch(
   'Date_Filter_VH-C_Dropdown'.Selected.Value,
   "This Week",
   Filter(Etcher_Cleaning_Sheet,'Date and Time'>=DateAdd(Today(),If(Weekday(Today())<>1,-Weekday(Today())+2,-6),Days) && 'Date and Time'<DateAdd(Today(),If(Weekday(Today())<>1,9-Weekday(Today()),0),Days)),
   "This Month",
   Filter(Etcher_Cleaning_Sheet,Year('Date and Time')=Year(Today()) && Month('Date and Time')=Month(Today())),
   "Year to Date",
   Filter(Etcher_Cleaning_Sheet,Year('Date and Time')=Year(Today())),
   Etcher_Cleaning_Sheet
)));
'PowerApp->ParseJSON,CreateHTMLtable,Sendanemail(V2)'.Run(TheTable)

The Result:
3.JPG

Best Regards,

Bof

Hello @v-bofeng-msft,

 

The filtered table would be sent to several people. I'm not too familiar with flows and having a hard time trying to figure out your steps. I've only tried to use them to covert the PowerApps Expense app to my own data, but I never did get it working. 

 

1/ Which property on the table do I add this code to? I see on the bottom of your post where you have "On your side the code should be" this sting in not apart of it, or is the test string?

 

 

ClearCollect(QQQ,{ID:1,ColumnA:"1",ColumnB:"2"},{ID:2,ColumnA:"1",ColumnB:"3"},{ID:3,ColumnA:"2",ColumnB:"2"},{ID:4,ColumnA:"1",ColumnB:"2"})

 

 

2/ How do I find/ make the ParseJSON or the table/Flow?

Is it one of the templates do I need to start from a blank flow?

 

 

Edit:

 

Ok so I was messing around with Flow and I got the ParseJSON setup the only thing that I missing is the Schema. I'm not sure how to make my table in to the Json.

v-bofeng-msft
Community Support
Community Support

Hi @Chrisguff12 :

Step1: To get the Schema, you must first get the JSON of your table

There is a very intuitive method: I have used this formula "Set(TheTable,JSON(QQQ));" to store the JSON of the target Table in the variable TheTable. You only need to add a label and set its Text property to TheTable to get the JSON of the target table.

Step2: Click ‘Generate from sample’ to automatically get the JSON schema

1.JPG

I think this link will help you a lot:

How to Parse JSON in Microsoft Power Automate 

Best Regards,

Bof

 

 

 

 

 

Hi,  @v-bofeng-msft 

 

So, I have been messing around with the solutions that you provided and somehow I stumbled into the system working even thou it’s still a little different from what you showed me. A lot of the options in the flow that you suggested and that were in the link you provided were different from what I was seeing.

 

Anyway, here is what my Flow looks like:

Chrisguff12_3-1613617446163.png

 

And the result I get is this:

Chrisguff12_5-1613617600173.png

 

Thanks for all you help.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,047)