Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confluence table transformer - Access href and text properties of link to rename hyperlink Edited

I'm using Confluence table transformer. I would like to rename an existing hyperlink as part of a query. Is there a way to access href and text properties of an existing link to rename the hyperlink? I need this in order to build a new FormatWiki based hyperlink with the updated text title.

2 answers

Hi @Jannis Louw ,

I'm not sure if I've gotten your case right but here is the option that I can suggest (if it doesn't suit you please clarify the question and attach some screenshots).

So here is your page in the edit mode:

Thu 12-1.png

The first column contains raw links that you manually paste for your wiki page. The second column provides description for your links.

The links in the first column can be often changed and it's not convenient to rename them manually. And, of course, raw links look not so appealing.

If this is the case, you may try the following SQL query:

SELECT
FORMATWIKI("[Click here|" + T1.'Regular link' + "]")
AS 'Check the required info',
T1.'Description'
FROM T1

Thu 12-2.png

Thu 12-3.png

Here we renamed all the raw links from the first column and hid the original raw view.

And if you need to construct (build) links from multiple text pieces put together (where the one changing piece comes from a table column) please follow this example.

Confluence_link.PNGHi @Katerina Kovriga _Stiltsoft_ 

 

This is very useful - thanks. My problem is however slightly different in that my table has links similar to the "Click here" link in your last screenshot - the link text is "Click Here" and does not contain the full address although clicking on the URL will take me to the desired location (as the address is set). I want to rename the "Click here" link text to something else without losing the hyperlink (link address). 

In order to do so using FormatWiki I need a way to access the Address property of "Click Here". 

Is there any way to do that? 

Thanks, Jannis

Hi @Jannis Louw ,

I've consulted with our developers and got a more complex SQL query that may suit your case:

Fri 4-1.png

Fri 4-2.png

SELECT *,
FORMATWIKI( "[Bla-bla link|" +
T1.'Link'->tfView->match("href=([^ >]*)")->1->slice(1, -1) + "]" ) AS 'New Link'
FROM T*

Fri 4-3.png

Now the Link and the New Link columns mirror each other and contain the same corresponding links (and you may hide the Link column, of course).

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

525 views 18 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you