cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Helper II
Helper II

Re: HTML Table Conditional Format

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?
Highlighted
Community Support
Community Support

Re: HTML Table Conditional Format

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.

Highlighted
Helper II
Helper II

Re: HTML Table Conditional Format

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.
Highlighted
Community Support
Community Support

Re: HTML Table Conditional Format

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.

Highlighted
Helper I
Helper I

Re: HTML Table Conditional Format

@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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (6,684)