You can use Apache FreeMarker Template Language (FTL) to access variable values,
show or hide response items, find key words in a user message, print a list of values, or
display arrays that are sorted by a specific data attribute. The basic syntax for these value
expressions is ${...}. You can incorporate FTL into the property definitions
for various dialog flow components.
Note
You
can also define the expressions using the if directive
(<#if>...</#if>).
If you
use an expression like ${MyMoney} in a
System.Output component in a skill with a YAML-based dialog
flow, you will see all the properties of the referenced currency JSON
object.
Return the set of values that are defined for a value list
entity.
Use the built-in type and
enumValues variable in the following
syntax:
String the operations together using a question mark
(?):
${VAR_NAME.value?ftl_function1?ftl_function2}
Referencing Entity Values in Multi-Language Skills 🔗
When you have multi-language skills, you should make sure the component that is
resolving your entities has Use Full Entity Matches
set to true. This enables you to write the following kinds
of expressions:
Expressions that reference the entity value in the language of the
conversation. You can use such expressions to do things
such as display the entity values to users in buttons, confirmation
messages, etc.
For such expressions, you append
value to get the value in the
language of the conversation. For example, if you have
defined a dialog flow variable, pizza, and
want to reference the PizzaSize entity value in a prompt,
you would use the following in the expression:
pizza.value.PizzaSize.value
(instead of just
pizza.value.PizzaSize).
Expressions that reference the value of the entity in the primary language.
The primary language value serves as a kind of key for the corresponding values in
all of the entity's languages. You can reference this value for business logic
purposes without having to worry about which language the conversation is in.
For these expressions, you append
primaryLanguageValue (e.g.
pizza.value.PizzaSize.primaryLanguageValue).