The HYPERLINK function creates Hyperlink and Image Link fields in your data source. Hyperlink fields display text links in tables. Image Link fields display clickable images in tables.
In this article:Syntax
HYPERLINK(URL, Link Label)
Parameters
URL
- a field or expression that evaluates to a URL.Link Label
- a field or expression that evaluates to Text or Image field types.
How the HYPERLINK function works
The HYPERLINK
function takes 2 parameters: a URL, and a link label. Both parameters are required.
The URL parameter can come from existing URL fields in the data source, or the parameter can be an expression that builds URLs from other fields and functions.
The Link Label parameter specifies the text or image to display in the table. To create a Hyperlink field, the Link Label parameter can be from a Text dimension in your data source, or any expression that evaluates to Text.
To create an Image Link field, the Link Label parameter can be from an Image dimension in your data source, or any expression that evaluates to Image. Image fields are created by the IMAGE function.
The HYPERLINK
function supports the following protocols:
- http:
- https:
- mailto:
- ftp:
If you specify an unsupported protocol, the link opens a blank page. If you don't specify a protocol, http: is assumed and prepended to the URL.
The Type drop-down menu is disabled for Hyperlink and Image Link fields.
To display the full URL as a link, use the URL field type.
HYPERLINK Examples
You can use HYPERLINK to create a product catalog with pictures of the items sold and links to individual product description pages.
Suppose you have a data set with the following fields:
- Item - the name of the product
- SKU - the product identifier
- Product Page - the URL of the product's description page
- Product Image - the URL of the picture of the product you want to display
For example:
Item | SKU | Product Page | Product Image |
---|---|---|---|
Pen | 123 | https://xyz.com/products/product123.html | https://xyz.com/images/product123.jpg |
Notebook | 456 | https://xyz.com/products/product456.html | https://xyz.com/images/product456.jpg |
Coffee Cup | 789 | https://xyz.com/products/product789.html | https://xyz.com/images/product789.jpg |
Creating a data source from this example gives you the following fields:
Field | Type |
---|---|
Item | Text |
SKU | Text |
Product Page | URL |
Product Image | URL |
Example 1) Create text links to product pages
To display links to the product description pages, create a Product Link calculated field with this formula:
HYPERLINK(Product Page, SKU )
The data source now looks like this:
Field | Type |
---|---|
Item | Text |
SKU | Text |
Product Page | URL |
Product Image | URL |
Product Link | Hyperlink |
You can then add the Product Link field to a table in your report. This displays the data as clickable links.
Example 2) Build URLs using CONCAT
Building URLs with the CONCAT function is useful when only part of the link path is present in a field, or when you want to override or add more information to the link.
For example, you could use CONCAT to combine a hardcoded page path with a product SKU to form a complete URL to your product description page:
HYPERLINK(CONCAT('http://xyz.com/productpages/product', SKU, '.html'), Item)
Example 3) Create clickable images
To add clickable images to a table, you also use the HYPERLINK function, but provide a URL as the first parameter, and an Image field, or an IMAGE function with a valid link to an image, as the second parameter. This creates an Image Link field.
For example:
HYPERLINK(Product Page, Product Image)
Add this field to your table to display clickable image links, as shown in the example below.
Image Link example report
The report above uses the following fields:
Field | Type | Definition |
---|---|---|
1) Product Link | URL | HYPERLINK(Item, SKU ) |
2) Image | Image | IMAGE(Image URL, Item) |
3) Image Link | Image Link | HYPERLINK(Item URL, Image Field) |
Links and thumbnail images from YouTube
The YouTube connector automatically provides links and thumbnail image fields you can add directly to tables in your reports:
Field | Type | Description |
---|---|---|
Video Link | URL | The link to the video on YouTube |
Thumbnail Link | URL | The link to the video thumbnail image |
Thumbnail | Image | The thumbnail image |
Linked Thumbnail | Image Link | The thumbnail image formatted as a link to the video on YouTube |