Reputation: 1
I have a dialog where users can enter one or more country names. How do I retrieve the values from the entity defined to store the responses.
Example : Entity : Country
Question : Where did you travel to?
Answer : Africa, Thailand and China.
How can I capture these 3 values in a list entity?
Upvotes: 0
Views: 572
Reputation: 187
Its Quite Simple. Use
"countries": "@sys-location.values"
It will list all @sys-location values in array form.
Upvotes: 0
Reputation: 849
Henrik is right, just to add to that, What he said will return them in an array, if you do
"countries": "<? entities['sys-location'] .toString() ?>"
you will get a comma separated list of the locations returned.
Upvotes: 1
Reputation: 17118
You can use the system entity for locations, @sys-location
. You need to turn that capability on for your workspace. See the wizard for entity creations.
In your dialog node where you want to capture the input in a list, you can assign those countries to a context variable. Switch to the JSON editor to edit variables. Then do something like:
"context": {
"countries": "<? entities['sys-location'] ?>"
},
See my collection of examples for context processing for something similar.
Upvotes: 0
Reputation: 330
@sys-location entity in System Entities extracts location from the conversation. (Note: Ensure that you have switched on that entity as shown below)
You can now see that location has been extracted from conversation
Upvotes: 0