Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

617 B
Raw Blame
import { unique_expression_name } from "cljs/metabase.lib.js";
import type * as Lib from "metabase-lib";

/**
 * Ensures expression's name uniqueness
 *
 * Example: if query has a "Double Total" expression,
 * and we're adding a new "Double Total" expression,
 * the second expression will be called "Double Total (1)",
 * the next one will be "Double Total (2)" and so on
 *
 * If the original name is already unique, the fn just returns it
 */
export function getUniqueExpressionName(
  query: Lib.Query,
  stageIndex: number,
  name: string,
): string {
  return unique_expression_name(query, stageIndex, name);
}