How to put array items in the conversation-driver template as a loop in bixby

70 Views Asked by At

i try to this code ↓

result-view.view.bxb

    conversation-drivers {
    if (size(arrayItem) > 0) {      //arrayItem : item1, item2, item3
      conversation-driver {
        template-macro (arrayItemTempl){
          param (arrayItem){
            expression (arrayItem)
          }  
        }
      }
     }
    }

arrayItemTempl.dialog.bxb

template-macro-def (arrayItemTempl) {
  params {
    param (arrayItem) {
      type (ArrayItem)
      min (Optional) max (Many)
    }
  }
  content {
    template ("#{value(arrayItem)}")
  }
}

result enter image description here

for each error, list of error... how to loop in conversation-drivers and template-macro-def

I want each item to be separate. [item1, item2, item3] ---> [item1] [item2] [item3]

2

There are 2 best solutions below

0
On BEST ANSWER

Unfortunately this is not possible. You will have to define a conversation-driver manually per item.

conversation-drivers {
   conversation-driver {
     ...
   }
   conversation-driver {
     ...
   }
   conversation-driver {
     ...
   }
}

Remember that the user will need to scroll to see all the conversation drivers if they are too many. Consider not having too many conversation drivers.

0
On

It is not possible to display a variable-sized array of conversation drivers and this behavior is intended as per Bixby's Design Principles.

Conversation drivers are meant to show reasonable next steps to a user. In a properly scoped capsule, users should rarely have more that 2-3 next steps to choose between. As a rule of thumb, I would recommend no more than 4 conversation drivers without good reason.

Additionally, large numbers of conversation drivers may result in issues with the capsule approval process which reviews all capsules intended for the Marketplace for their user experience.

I would recommend exploring the Design Guides available in the developer documentation. The Designing Conversations and Designing With Bixby Views guides will be especially useful for your use case.