Cell formatting

I’m working with a table visual that uses this calculated field:

"expression": "concat('[', title, '] \r\n', page)"

This concatenates the page title and its URL into a single cell (with a line break between them). When the title is very long, it wraps onto three (or more) lines and pushes the URL out of view.

I’d like to:

  1. Limit the title to two lines of text.
  2. If the title is longer, show its full text in a tooltip on hover.
  3. Always reserve the third line for the URL, so it’s always visible.

Is there a way to enforce these formatting rules in the table visual?

Hi @ttientrung!

What about something like this:
create a calculated field (assuming 100 is the max title length we need):

output_title = 

ifelse(
    strlen( {title} ) > 100, 
    left( {title}, 100 ),
    {title}
)

EDIT: even better solution using substring, as suggested by @ttientrung

And this should solve the issue of the two lines (just check the max length you need).

For the tooltip, on a Table Visual there no possibility to add a tooltip in this moment. On the visuals where it’s possible to create a tooltip, you should see it under “Interactions” menu.

You can try exploring the HighCharts capability, where with some code you can do more advanced stuff.

A workaround can be something like this:

  • Create a new Interactions > Actions > Add Action
  • In the Action Name set something like Full Title: <<Title>> (<<Title>> means that this placeholder will be replaced by the value of the indicated field on the row you click on)
  • Select Menu Option
  • Action Type: Navigation
  • Target: same sheet as you are

This should create an empty Action, that does nothing, but in the menu (right click of the mouse) you will see, for each row, Full Title: My Selected Title.

Hope this helps!
Andrea

Hi @andrepgn, thank you for your reply.

Regarding the solution where you suggested creating a new calculated field to check the length of the title — I think using substring could help achieve that. However, one concern is that when I hover over the cell, I still want to be able to see the full title.

Also, at the moment, I’m unable to change the visual type from a table to something else, so the workaround you provided seems like something I can work with for now.

Thanks again!

Yes! You’re right, substring it’s even better :slight_smile:
If that solves the issue for the moment, I’ll edit my previous answer with substring and indicate it as solution!

For the tooltip, at the moment I say try with the workaround!

Thank you,
have a nice one!

Andrea

1 Like