cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

HTML Table Conditional Format

Hi,

I'm using the Transform Data SQL action to produce a table of due dates for upcoming scheduled maintenance. These are based on time since a "last done date". The query is working well to calculate days left until the due date but as a final step I'd like to output this query to an HTML table.

After some other Googling, I've discovered how to insert borders and padding to make this HTML table look suitable for distribution using the Compose action.

As a final touch I would like to add some conditional formatting to the column which shows "days remaining" that will get a color based on how close it is to zero. For example 0-20 days gets red, 21-50 days orange, then yellow, then green, etc. Can this be expressed to Flow after the HTML table is created before pasting to an Outlook email?
5 REPLIES 5
Helper II
Helper II

I've continued searching for this type of solution and the closest I've found is on this link:

https://alextofan.com/2019/02/14/flow-how-to-change-the-style-of-your-html-table-in-flow/

From my noobie point of view this of course seems pretty intimidating but the end result is just about what I'm looking for.

Anyone have any experience with this type of conditional HTML table output?

Hi @Anonymous5,

 

You need to change the condition of the original expression of the article, the structure is similar to the following:

if(and(greaterOrEquals(variables('Number'),0),lessOrEquals(variables('Number'),20)),variables('varStyle').rowStyleLowValues,variables('varStyle').rowStyleHighValues)

It means if the number is greater than or equals to 0 and less than or equals to 20, return a low value, or return high value.

And the value you can set in the variable shows in the article.

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

Thanks Lin,

How would this entry change for a 3-color arrangement? For me I’d like to have critical in red 0-20 days, marginal in yellow and all others just in white.

Hi @Anonymous5,

 

If you want to change three colors, you could use another if expression to instead of the third parameter of first if expression.

 

if(and(greaterOrEquals(variables('Number'),0),lessOrEquals(variables('Number'),20)),variables('varStyle').rowStyleLowValues,if(and(greater(variables('Number'),20),lessOrEquals(variables('Number'),40)),variables('varStyle').rowStyleMiddleValues,variables('varStyle').rowStyleHighValues))

 

If the Number is not greater than or equals to 0 and not less than or equals to 20, perform the second if expression.

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

Helper I
Helper I

@Anonymous5 , Is this been resolved? I am too looking for some what similar. Want to sent in email. 
Example i  have table with column name status.  If status is risk then red color, if safe then green color, if warning then yellow .

can you share screenshot of your solution..

 

exp.JPG
emailcol.JPG

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (60,889)