cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Applying Hyperlink to Gallery Label

Hello,

 

I am trying to figure out how to apply a different hyperlink for every item within a given gallery? Ideally the title of the gallery item would be dynamically inserted into the link being searched to locate a specific document.

 

Any guidance would be greatly appreciated.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

If you have the hyperlink on each item of your data source, then you can certainly do that. I can think of two ways how you can implement this. One way is to use the Launch function in the OnSelect property of your label, and when someone clicks it, you launch the URL that is associated with the item; you may want to make the label to look like a link if you want. Another way is to use an HtmlText control, on which you can define the text that you want to show as a HTML link (<a...>) tag, composing the html text to use both the text you want to display and the URL you want to link. The app below shows both alternatives:

 

ForumThread458401.gif

 

I'm also attaching the app shown below. To open it, save it locally, then go to https://create.powerapps.com, then select Open, Browse, and find the app that you saved.

Hope this helps!

View solution in original post

4 REPLIES 4
CarlosFigueira
Power Apps
Power Apps

If you have the hyperlink on each item of your data source, then you can certainly do that. I can think of two ways how you can implement this. One way is to use the Launch function in the OnSelect property of your label, and when someone clicks it, you launch the URL that is associated with the item; you may want to make the label to look like a link if you want. Another way is to use an HtmlText control, on which you can define the text that you want to show as a HTML link (<a...>) tag, composing the html text to use both the text you want to display and the URL you want to link. The app below shows both alternatives:

 

ForumThread458401.gif

 

I'm also attaching the app shown below. To open it, save it locally, then go to https://create.powerapps.com, then select Open, Browse, and find the app that you saved.

Hope this helps!

Anonymous
Not applicable

@CarlosFigueira 

This is very helpful, thank you!

 

If the data is updated to include additional entries, is there a way to edit links based on a formula for new entries or is this outside the scope of powerapps' functionality? Perhaps you can advise an alternate method of doing something like this. 

 

Once again, thank you for your help

If you can compose the link based on some information that is already in the record, then you may be able to use a formula for that. For example, if the item has an id, and the link uses that id, you can use something like Concatenate("https://my.company.com/items/", id) to create the link.

If that is not the case, then you will have to add an additional column to your data source to create the link, and you can edit it in PowerApps itself - for example, if you are using an edit form, you can add this new field in the form.

Hope this helps!

tauseefmsk
Frequent Visitor

You can even use a Button control. How this works is:

  1. You have a single line of text called "url" in SharePoint list to store the URL.
  2. Use a button control in the Gallery.
    • Set "OnSelect" property of button to "Launch(thisItem.url)"
      tauseefmsk_0-1639750985899.png
    • Set the "Visible" property of button to "If(IsBlank(ThisItem.url),false,true)"
      tauseefmsk_1-1639751089926.png

      The visible property will show button only in record where the url is present and is hidden for records where url is absent as shown below

      image.png

I hope this Solution helps. Happy PowerApping 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,903)