cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

SQL Get Rows similar to WHERE statement and send as email with excel attachment

I am trying to build a flow that will grab rows from an SQL view. I want to filter it like a query with a WHERE statement like WHERE [Date Field] = '2019-10-31' I can't figure out how to formulate the GetRows for that?

 

Second question, I would like this flow to be triggered from within a PowerApp. The idea is the app will generate the rows, the flow will grab the rows maybe with the filter input from above from app or asking user and then grab those rows and email them to the user in an Excel file.

 

I have looked at guides and templates and not having much luck figuring this out. Any pointers to similar that I could look at and understand would be great. Thanks.

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: SQL Get Rows similar to WHERE statement and send as email with excel attachment

Hey @BrianHFASPS 

 

For a Get rows action in MS Flow, you can refer to the following doc to get filtered rows using odata filter queries: https://flow.microsoft.com/en-us/blog/advanced-flow-of-the-week-filtering-with-odata/

 

To trigger a flow from powerapp, you can get started here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

 

Note that you can send data from PowerApps to flow in string format and then deserialise in flow. A better option would be to trigger the flow simply from a PowerApps button and in the Flow, add the get rows action and the filter query and then populate the excel with those extracted rows. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Post Patron
Post Patron

Re: SQL Get Rows similar to WHERE statement and send as email with excel attachment

Thanks for the response but I guess I am not understanding the translation of SQL commands to odata commands. I got it to work sort of by switching to SQL Run Query. Here is what I am trying to do.

  1. User presses button in Powerapps.
  2. Powerapps what to file on, like 2019-10 or 2019-11
  3. Flow then takes that response and runs SQL View with filter based upon that entry
  4. Resultant table is inserted into an Excel file (or CSV)
  5. File is then emailed to user.

If I use a SQL Query I don't see anyway to use a variable inserted from Powerapps? Is there anyway to make a temporary Excel in the flow or does it have to save it to OneDrive in process. I really just want to take the SQL response in table form and email it to user. Is that possible? 

Highlighted
Dual Super User
Dual Super User

Re: SQL Get Rows similar to WHERE statement and send as email with excel attachment

Hey @BrianHFASPS 

 

Please take a look at the screenshots below: 

 

ddw1.PNG

 1. You can initialize a variable and get the value for it from Power Apps. and later use that in the query.

ddw2.PNG

 

2. directly request a variable value from PowerApps in the action for the query. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Community Support
Community Support

Re: SQL Get Rows similar to WHERE statement and send as email with excel attachment

Hi @BrianHFASPS ,

 

Have your problem been solved?  If yes, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best Regards,

Alice

 

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

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (11,200)