Macros

The Macros feature in AnalyticsCreator allows reusable SQL expressions or logic blocks to be centrally defined and referenced across multiple objects in the project. Macros help standardize transformations and reduce redundancy in calculated columns or expressions.

Function

A Macro represents a named T-SQL expression that can be injected into generated SQL scripts. Macros are typically used for logic such as date conversions, conditional formatting, or derived column values that need to be reused in multiple tables or transformations.

Access

Macros are defined in the Macros module under the DWH menu. Each macro includes a name, language, referenced table (optional), and the SQL statement to be generated.

Properties

ID Property Description
1 Name Unique identifier for the macro used in referencing expressions
2 Language Specifies the SQL dialect or scripting language used (e.g., T-SQL)

Screen Overview

The image below shows the List Macros interface with columns labeled for easy identification

Macros List

Behavior

  • Macros can be reused in calculated columns, transformation rules, and expressions
  • Macros are substituted inline during SQL code generation
  • Changes to a macro affect all referencing objects upon regeneration
  • Macros support SQL syntax specific to the selected language (e.g., T-SQL)

Notes

  • Macro logic must be valid SQL when substituted into the target expression context
  • Macros are stored in the project metadata and regenerated per environment
  • Macros do not support parameterization; each macro is static in definition