metabase / metabase/metabase

Expression for truncating + ellipsizing text

Open
#26,417 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Querying/Notebook/Custom Column Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**Is your feature request related to a problem? Please describe.**

Sometimes my database's field values have long text. When I create a table and add it to a dashboard, these long values cause the dashboard table columns to become very wide, requiring horizontal scrolling in order to see other columns. I'd like to trim down the fields to a shorter length, and know that they've been trimmed (by adding an ellipsis at the end of trimmed text).

**Describe the solution you'd like**

A simple expression that takes the string to ellipsize and the maximum length, e.g. `ellipsize(text, length)`.

**Describe alternatives you've considered**

I can implement this now using existing expressions — `case(length([Title]) > 50, concat(substring([Title], 0, 50), "…"), [Title])` — but it would be handy to have a simpler expression to express that.

**How important is this feature to you?**

Not critical, just a small usability improvement.

:arrow_down: Please click the :+1: reaction instead of leaving a `+1` or `update?` comment

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no file, test, or entry point. Start by locating the existing expression implementations and their tests, then trace how expressions are used in dashboard tables. Done means a simpler expression can shorten long text to a requested maximum and visibly mark trimmed values with an ellipsis.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.