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

Hide an HREF Link if no Data

I have a table created in a Select Statement that is sent in an Email.  In the value field of the table, I am formatting as an href with an expression in the middle: <a href = item()?['Recap_x0020_Picture']>Pic</a>

Sometimes that field in SharePoint is left blank.  But the href tag will obviously show up regardless of whether there is data or not. I'm wanting to see if there is a way to leave that field in the table blank if there is no data, so as to not have users click on links that do not go anywhere. 

 

theBrianL_0-1626299343306.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

For the picture property, you want to use an expression.

ekarim2020_1-1626306053989.png

For value2 mapping above, the expression would be something like:

 

if(empty(item()['Value']),'', concat('<a href="',  item()['Value'], '">Pic</a>'))

 

If the item()['Value'] is empty, return an empty string, else construct a HREF tag.

Note: The concat function will return data for value2 looking like:

ekarim2020_1-1626305884888.png

However, it should be rendered correctly as HTML:

ekarim2020_2-1626306275176.png

Your expression would look similar to:

 

if(empty(item()['Recap_x0020_Picture']),'', concat('<a href="', item()['Recap_x0020_Picture'], '">Pic</a>'))

 

 

Ellis

 

View solution in original post

1 REPLY 1
ekarim2020
Super User
Super User

For the picture property, you want to use an expression.

ekarim2020_1-1626306053989.png

For value2 mapping above, the expression would be something like:

 

if(empty(item()['Value']),'', concat('<a href="',  item()['Value'], '">Pic</a>'))

 

If the item()['Value'] is empty, return an empty string, else construct a HREF tag.

Note: The concat function will return data for value2 looking like:

ekarim2020_1-1626305884888.png

However, it should be rendered correctly as HTML:

ekarim2020_2-1626306275176.png

Your expression would look similar to:

 

if(empty(item()['Recap_x0020_Picture']),'', concat('<a href="', item()['Recap_x0020_Picture'], '">Pic</a>'))

 

 

Ellis

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,762)