Aymal Khan
Aymal Khan

Reputation: 289

Watson Assistant Dynamic Array(Context Variable)

The Chatbot is detecting Law's(family law, contract law etc.)using a single entity with 200 plus values(Law's) Based on user response using this:

<?@All_Foci.values?> 

E.g. A user says I have problem in my contract's help me ?, chatbot detects law's using entity @Focus and than are saved in an array $Detected_Foci

I want to show user the $Detected_Foci dynamic values in the option response type.

 $Detected_Foci ["Sales contract law", "Contract law"]

How can I do that kindly help ?

Upvotes: 0

Views: 386

Answers (1)

data_henrik
data_henrik

Reputation: 17166

See here for an example of how to convert an array to a string output.

{
  "context": {
    "detected_foci": [
      "contract law",
      "family law"
    ],
    "array_in_string": "this is what I have: $detected_foci"
  }
}

You could also directly refer to detected_foci in your response:

Here is what I have: <? $detected_foci ?>

Upvotes: 1

Related Questions