Skip to content

Use Named Expressions

Named expressions let you insert runtime values into expression-enabled fields.

Example

Instead of hardcoding a term:

https://example.edu/report?format=csv&academic_period=202640

Use a named value:

https://example.edu/report?format=csv&academic_period={{current_term}}

SQL scalar value

A SQL scalar value should return one column and zero or one row.

select id
from academic_periods
where current_timestamp between start_on and end_on
  and category = 'term';

If the query returns:

Result Behavior
zero rows resolves to an empty string
one row / one column resolves to that scalar value as text
multiple rows runtime error
multiple columns runtime error

Migration from legacy artifact expression

Legacy pattern:

academic_period={{artifact}}

Preferred pattern:

academic_period={{current_term}}

Good names

Use clear names:

current_term
run_date
next_page_token
output_file_name

Avoid vague names:

value
thing
data
artifact2