Hi, I have created a flow that builds an HTML table based on an array (following one the examples form the forum. WOrks perfectly except that I don't need to send all columns, only a few and even includes the ones used by PowerApps.
I tried the advanced options for custom columns but enable to make it fly. Adding screencapture for reference, in escence need to pick which columns to show so then I can send the "custom" table via emails.
Thanks in advance.
According to the screenshot you provided, it seems that you are getting rows from an Excel. I create a simple flow to test this issue on my side.
When creating the flow, I don’t get the message asking me to add a foreach.
The flow is configured likes below. And it works fine on my side.
Please take this for a reference and try again with it.
Hi Mabel, thanks for the reply. It kind of worked but did not achieve my goal. Perhaps I should explain...
I have an excel table with details in each row, example:
Normally would send an email per row but is way to many for the same customer, so what I would like to do is an array based on a list which is dynamic (it is a list from a different table in the same file that I created via power query), not always the same customers with an output of a table but not including all columns (the one created by powerapps for example) like this:
Tried your example, it did work but is not grouping them... is sending an email per row. (Flow keeps adding apply to each all the time)
The goal is to send a table with the selected columns to each customers via email.
Perhaps I'm using the wrong apporach:
Thanks is advance
There are two Get rows actions in your flow. Are they getting rows from different tables? As you said that “it is a list from a different table in the same file that I created via power query”.
There is a Consignee column in both the two lists, and you want to get columns when there is a common consignee in the two list, right?
Exactly, 2 get rows, different tables and consignee matches I used the second table to identify or to set the array parameters.
The second table has the list of customers and it is generated via power query everytime is refreshed.
Appreciate the help.
Hi, Just wanted to share that I managed to solve it (thanks to http://johnliu.net/ magnificent post) by manipulating the data via JSON in with SELECT.
Basically, was able to select the right properties I needed following this structure:
The output is easily transformed to a HTML or CSV Table.
@fermoreno could you post your solution please? I am working on a similar flow where I need to go through a list, group the items that satisfy the condition (such as listing vans due for MOT in the next 30 days) and send a table of the van details.
Will use fake data as you know... sensitive stuff. It's reading from a XLS with 2 tables but you could use other arrays like JSON.
I started with a file with 2 tables (one per sheet) with the info I need, the result will be a table for each customer in the second table. (4 Tables in total in this example).
I developed this because I needed only some columns and not all from a larger data set (and not include the columns added by powerapps)
In this case, a manually triggered flow that Get Rows from each table.
Then starts the tricky part. Create a FILTER operation (do not add the apply to each, will be done automatically). in From you select the COLUMN (Customer in this case) from Data table to be equal to COLUMN (Customer also) in Customer_list table), in advanced mode looks like this: (Flow will add the apply to each automatically since is an array of elements)
Then you add a SELECT step where you will need to use from the Body of Filter Array Output, in Map suggest to add the column names that will be displayed in your CSV or HTML table and then click the advanced mode (highlight in yellow).
Very important, you will have a JSON structure that you need to complete, for sake of the example (and being organized) the Property label (let's call them Columns) is the same as the want to fetch from the filtered data. This is not mandatory, you can put the label or Display name differently but the info to fetch needs to be the same as from the output of Filter (careful with spaces and special characters, makes it more tedious). So, for SKU label I want to fetch the data that was on the SKU column in my excel, (all of them, one by one) to be more clear with this example will be: "SKU":@item()?['SKU'], you continue until you are done with all, if you break the JSON structure it won't let you continue. I always do it in text/advanced mode.
Almost done, the output of SELECT needs to be added to step Create CSV table or HTML, as you wish to then easily incorporate to an email or whatever.
If we examinate the output of the Flow you will see with more details how the XLS table input is managed in Flow as JSON object and then manipulated.
This a simple example, I have managed (after trying and trying over weeks) using this approach with more complex info (like JSON arrays and outputs from Web APIs) but it is very similar.
Let me know how it works, if you have trouble post your screenshoots to guide you directly.
Thanks for the reply. The issue I have is I can't select the filtered array items for my Select Map. I don't know if this is because I used Get Items SharePoint (and not from a spreadhseet).
Hi, never been able to be pulled from the Dynamic Content tab. Although you can retrieve them in with "text mode" in Select with the very same technique that I describe you:
Please be aware that sharepoints uses a "code" instead of column name... suggest to run your flow to the point of Filter Array and check the output so you can see the JSON structure, below a screenshoot (sorry to mask stuff, but cannot share it fully).
You should be able to retreive what you need with Select and then to HTML.
Hope it helps, if not share the JSON output of your sharepoint and will help you to create the text that you need for Select.
Hi Fernando. @fermoreno
This is the closest solution to the problem I'm having.
My flow executes a an SQL query and I need to send and email with HTML table for each sales order. So in this case a need an email with a table with Sales Order 1 and another email with the rows with Sales Order 5.
How can you filter this?
Hi, I'm making a lot of assumptions since I'm not familiar with your table in SQL but I tried on one database that I have an managed to do it like the image below.
I'm assuming that the email address is included in the same table therefore, I have 2 queries. One retrieving all the data and another one with SELECT DISTINCT just for 2 columns: email and sales order (sorry in the image put it as Order ID).
Anyway, with this process it will filter unique sales order with the respective email for the first table and with select you arrange the data a bit and ready create HTML table.
After the send email should be enough and you can fetch the email needed from the the 2nd table result with email item.
Hope this helps, if not please let me know.
This is working great, but I have a question about the final outcome. I tried this approach and had an HTML table at the end instead of CSV. As you mentioned, the results produce 4 tables (one for each customer that is listed on the customer table). In my case, I had 95 customers, so the output for 'Apply to each' action was 96 html tables, one for each customer. My question is, how can I pull out the html table of a specific customer from that pool of results? For example, I want to get one result out of the 96 (let's say customer A only), and combine it with another html table (also for customer A) that is generated with another flow. The ultimate goal is to send each customer a detailed report on the items they purchased from different categories. However, I can't manage to get individual outputs from the 96 results. I can either send the individual report via email or through a PDF. Any help is much appreciated!
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.