Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
TaraM
Alteryx Alumni (Retired)

A number of people have asked how they might embed web links in their Alteryx HTML reports. This is a good task for the Text tool's Expert Mode.

 

Expert Mode is a way for you to custom craft your own PCXML and turn it into a snippet so you can include it in your reports. PCXML is very similar to HTML, although there are some significant differences that I won't get into here. For web links, however, it is essentially identical.

 

For those of you who aren't familiar with what a web link looks like in HTML, here is an example:

<a href="http:\\some.place.on.the.web">The-text-you-see-with-an-underline</a>

 

There are two parts to this. The first is the URL that you want the user's browser to go to when the link is clicked, and the second is the text you want to appear on the screen.

 

So the first thing you need is those two pieces of information. Here is a snapshot of a Text Input tool I used:

 

Text Input.jpg

 

Next, I needed to convert these two things into a snippet. I used a Text tool in Expert Mode for this:

 

Report Text.jpg

 

You should notice a few things:

      • I am using Expert Mode. This means that the content should be treated as actual PCXML, and not text. If I didn't do this, you'd see the <a href...> stuff in the final output and not the link.
      • I manually added the "href="http://" part to the link, since it wasn't in the text coming in.
      • I used both incoming fields to construct the link, so that there would be pretty text displayed.

 

After this tool, I simply dumped the SiteName field and the new Text field (the link) into a Table tool and then a Render tool, rendering to HTML. That's it!

Tara McCoy

Tara McCoy is the Creative Director at Alteryx. Since joining Alteryx in 2004, Tara has held roles in Product Management, Content Engineering, and Community where her focus has always been on delivering an amazing product experience with Alteryx. From designing product icons and community badges, procuring excellent swag, concocting engaging contests, and crowdsourcing content from internal and external Alteryx advocates alike, Tara is dedicated to the Alteryx brand and wants everyone to experience the thrill of problem solving with Alteryx.

Tara McCoy is the Creative Director at Alteryx. Since joining Alteryx in 2004, Tara has held roles in Product Management, Content Engineering, and Community where her focus has always been on delivering an amazing product experience with Alteryx. From designing product icons and community badges, procuring excellent swag, concocting engaging contests, and crowdsourcing content from internal and external Alteryx advocates alike, Tara is dedicated to the Alteryx brand and wants everyone to experience the thrill of problem solving with Alteryx.

Comments
AlexKo
Alteryx Alumni (Retired)

Great article! Another tip to build on this - if you want your link to always open in a new tab, just use target="_blank" in your html:

 

<a href="http://some-place-on-the-web.com" target="_blank">The text you see with an underline</a>

Also, some URL's have ampersands & in them - this will cause an error if used to create a link in the PCXML of the Report Text tool.

RithiS
Alteryx
Alteryx

Great info, Tara and Alex! If the URL has an ampersand symbol in it, add amp; right after it.

 

For example, say the URL is:

 

https://www.google.com/maps?saddr=80002&daddr=80226

 

 

This will cause an error. Adding amp; after the & will let it output in PCXML correctly. Here's the new URL to use with bolded emphasis:

 

 

https://www.google.com/maps?saddr=80002&amp;daddr=80226

 

 

GavinAttard
11 - Bolide

 Great Stuff! Thanks for the tip. 

 

Add one more to the 'never thought we'd use Alteryx for' - Converting our xml sitemaps into HTML sitemaps

 

 

Hollingsworth
12 - Quasar
12 - Quasar

Thanks Tara!

 

File this under, "the user will never know how much easier I just made this for them."

Duncanvp
6 - Meteoroid

I am creating dynamic hyperlinks in a report that uses lots of special characters and the urls are failing.


~ are becoming %7E
* are becoming %2A
% are becoming %25
; are becoming %3B

 

It sounds like PCXML is the answer.  Where can I find the PCXML map for these?

AlexKo
Alteryx Alumni (Retired)

Hi @Duncanvp - here is a table that will provide the HTML codes for those symbols:

https://www.rapidtables.com/web/html/html-codes.html

 

PCXML is a markup language so these should be interpreted correctly. Hope it helps!

RWvanLeeuwen
11 - Bolide

I use a weekly challenge checklist that loads data from the webpage directly, parses and cleans the dataset and then adds indicators to a report table as to whether I completed the challenge.

 

A report text tool is used with the following formula <a href="[URL]">[Challenge Name]</a>

However it results in an incorrect hyperlink text e.g. ">Join to Range

 

I am unsure how to solve this and I feel this is a bug in Alteryx as both fields used in this formula are devoid of the text '">' and this workflow worked perfectly until about a week ago. Same Alteryx Designer, same webpage... Please help

 

ScottG
Alteryx Alumni (Retired)

If you run into an error message using the Report Text Tool with PCXML, you may want to check if your data stream includes characters that would result in invalid XML.  For example, an ampersand "&" may cause an error. 

 

Using the Replace function in the Formula Tool will solve this particular challenge.