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?
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.
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.
Its Quite Simple. Use
"countries": "@sys-location.values"
It will list all @sys-location values in array form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.