0
votes

I am trying to create a chatbot with watson Conversation. I am facing issue in displaying an array output in my chat window.

For example: In my context I have an array name productDetails like below:

context : Object
conversation_id : "xxxx"
Amount : "52.80000"
productDetails : Array[0]
    ab :"1.0"
    cd :"2.0"
    ef :"4.0"
    gh :"5.0"

This array is dynamic, it may have 2 value pairs or it may have ten value pairs as well based on previous selections

I want to display complete array as it is in the Watson chat window. Can any once suggest me how I can do this.

Regards, Abhi

1
See also this related question: stackoverflow.com/questions/41160887/…ralphearle
If it is already stored in context, you can simply type in the Watson Responds section $productDetails and it should show the entire array in your output. Let me know how this goes or if you needed something more specific.Mitch
@Mitch Thanks for reply. I was under same impression but it is not showing me the output. I can see array is available in previous and this step where output is shown but output shows like: You array output is [] . Following is my Watson response: { "output": { "text": "You array output is $productDetails" } } Regards, AbhiAbhi
@Abhi Well in your example above you have defined productDetails : Array[0] = which is an array of zero elements. In this case the Conversation would output Your array output is [].Michal Bida

1 Answers

0
votes

Can you check if there is a double occurrence of {"output":{"text":{"output":{"text" ... in the advanced output window of your dialog node ?

If so, remove one of them