Jump to content
  • 0

Conditional display of link in a table




I am trying to introduce a link into a table column based on the presence or absence of a value in a field. Ideally if the field is null the link (SMQ) in the pic is not displayed (or a message is displayed as in the code below).


I am not sure if the best solution is a case-when-then or a javascript.

Here's the statement in code format (it doesn't work - just displays the <a href... in the table!):

WHEN [@field:SMQcode] <> ''
THEN '<a href = "https://website.html?
ELSE 'No SMQ available'


Any advice would be greatly appreciated.



Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @SteveMott,

your case when can actually work (with a few changes), but since you are trying to output an <a> tag which is an HTML element, it wouldnt render on calc field alone, so you would have to pass in the result of the calc field to an HTML block. 


First, your Formula on the Calc Field would have to be:

WHEN [@field:SMQcode] = ''
THEN 'No SMQ available'
ELSE '<a href = "https://website.html?


For the HTML block calling in the value of the Calculated Field:



Then, you'd simply have to hide the Calculated Field column using CSS:



table tr th:nth-child(3), table tr td:nth-child(3){
display: none;



wherein 3 refers to the third column in my Tabular Report because that's the order where the Calculated Field comes in. Just change it to whatever order your Calc Field comes in.


Hope this helps!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...