rf! value in tooltip

I'm trying to use rf! to access a column's value in a record grid.

The idea is to truncate the field in the grid with left() and concatenate with "..." if the value is too long, then set the tooltip to the full field so one can see it when pointing the mouse.

However, I get this error:

Expression evaluation error [evaluation ID = 3Y9NCYSP] at function a!recordListVisualizations: Could not find variable 'rf!description'

Can't I use rf! for tooltips in fields as I do for components?

The SAIL expression editor suggests that rf!description is in the scope when editing the tooltip.


Thanks in advance.

  Discussion posts and replies are publicly visible

  • HI Stefano

    Assuming you're uing a Text component for this, the 'Tooltip' only applies to the column header's label, which isn't associated with any individual record (which is why you don't have access to an rf! field). 

    Assuming your design objective is to show the first, say, 50 characters of a field's content in the relevant column, with an ellipsis (...) to indicate that there is more to see, and then be able to see the full text.

    You could use a Rich Text display field, have the shortened version of your text as the value fo a Rich Text item, and the longer version as the 'Caption' of a Rich Text Image. Something like this:

    {
      a!richTextItem(
        text: {
          fn!concat(
            fn!left(
              rf!description,
              10
            ),
            " (...)"
          )
        }
      ),
      a!richTextImage(
        image: a!documentImage(
          document: a!EXAMPLE_DOCUMENT_IMAGE(),
          caption: rf!description
        )
      )
    }

    (obviously, tailor for your specific needs)

  • Thank you for the answer and the solution!

  • Here's an alternate implementation, still using a Rich Text component:

    a!localVariables(
      local!shortText: fn!concat(fn!left(rf!description,10)," (...)"),
      local!longText: rf!description,
      local!isShortText: true,
    {
      a!richTextItem(
        text: if(
          local!isShortText,
          local!shortText,
          local!longText
        )
      ),
      a!richTextItem(
        text: if(
          local!isShortText,
          " Show more",
          " Show less"
        ),
        link: a!dynamicLink(
          value: fn!not(local!isShortText),
          saveInto: local!isShortText
        )
      )
    }
    )