2

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

Jennybou
  • 19
  • 1

1 Answers1

0

You are correct that there is no for-each child key inside conversation-drivers. Nice workaround with if and I'm afraid that's the way to go for now.

One note about conversation-drivers, it might not look pretty if more than 3 choices due to the mobile device screen size. You may want to check sample view with the 6 items first.

Have fun with Bixby!