I'd like to dynamically add some Conversation Drivers using items in a list, there may be 0 or more items up to 6.
A for-each loop is currently not allowed in the conversation-drivers block so I have resorted to using 'if' statements and selecting the corresponding item in the list.
conversation-drivers {
if (size(this.options) > 0) {
conversation-driver {
template ("#{value(this.options[0].name)}")
}
}
if (size(this.options) > 1) {
conversation-driver {
template ("#{value(this.options[1].name)}")
}
}
if (size(this.options) > 2) {
conversation-driver {
template ("#{value(this.options[2].name)}")
}
}
}
This works but it's ugly, is there a better way?
Thanks