Custom Columns in create HTML table after array

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.

Re: Custom Columns in create HTML table after array

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.

Re: Custom Columns in create HTML table after array

@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.

Re: Custom Columns in create HTML table after array

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)

XLS Samples

In this case, a manually triggered flow that Get Rows from each table.

Import the 2 tables

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)

@equals(item()?['Customer'], items('Apply_to_each')?['Customer'])

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).

Add filter to tables

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.

Select to Output - JSon Structure

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.

Create CSV

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.

Output

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.

Re: Custom Columns in create HTML table after array

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:

{

@item()['column']

}

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.

Re: Custom Columns in create HTML table after array

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.

Re: Custom Columns in create HTML table after array

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.