Tags

Turn values into parameters using a special syntax.

Though we use functions within SEL models, as far as the outside world is concerned, SEL models themselves are essentially functions. Since functions are more powerful when they can take input values (arguments), SEL provides modelers with a way to specify arguments. In SEL, we call these tags.

Defining a tag

We can define a tag inside a SEL expression by using < and >, like so:

=100<users>

In this case, <users> is the tag, and users is the parameter of the tag.

Using tags in SEL is encouraged for two reasons. First, a tag helps to clarify our assumptions and logic for ourselves and other readers. For example, the event title may be "New Customers", but is this 100 users or 100 accounts?

Tags can be placed after any constants, inside or outside of lists and function calls:

=Source(1.5k<leads> @ 5<leads_growth_rate>%)

Second, in addition to acting as convenient labels, tags have another special purpose: defining input parameters! In this example, leads and leads growth rate are now parameters in the model.

We can use the same parameter in multiple places in a SEL expression, like so:

=Pool(100<credits> + (1.2<multiplier> * 100<credits>))

In this case, if a value for credits is passed to the model, that value will be inserted in place of both of the 100s.

Model parameters are used by the forms view of an event and by the presentation mode of a model in order to turn a SEL expression into input fields.

🚧

Parameter formatting

The best practice for the parameter element of a tag is to use lowercase_without_spaces_or_symbols. For example, metric_tons is a strong parameter. While Metric Tons would also work, spaces and capitalization can be challenging to deal with as your model becomes more advanced.

Using aliases

When a tag is turned into an input field, by default, the Summit Editor will convert the label to Title Case on the event, like so:

users -> Users
metric_tons -> Metric Tons
cash_balance_usd -> Cash Balance Usd

As you can see, this isn't always ideal, because USD should be capitalized in full. We can fix this using an alias.

An alias appears in a tag after the parameter name and a : colon, like so:

=Pool(100k<cash_balance_usd:Cash Balance USD>)

This gives you the freedom and flexibility to have the label appear differently than the raw parameter, or to correct the way the automatic formatting to Title Case works by default.

Aliases also allow us to make it clear that the same parameter used in different places has different meanings. For example:

=Pool(100k<amount:Savings>)

=100k<amount:Savings Portion> + 30k

In this case, the author of the SEL wants the 100k value to use the same parameter, but to communicate that this value has different meanings depending on where it appears. Aliases allow the author to express this distinction by making sure the label on the event form appears differently on each event.


Did this page help you?