Echo & Alexa User Discussions and Support Forums

When a person is not breathing, permanent brain damage begins after 4 minutes and death in 6 minutes after that. Can you count on help arriving before that time? Learning proper CPR techniques is easy and you can learn it in 30 minutes at CPR Test Center.

Handling multiple slots in single intent

0 Members and 1 Guest are viewing this topic.

Handling multiple slots in single intent
« on: October 28, 2015, 05:16:20 am »
Does anyone know if this is possible?
I have an intent like {
{
    "intents":
        [
            {
           {
                    "intent": "Values",
                        "slots":
                        [
                            {
                                "name": "Value1",
                                "type": "LITERAL"
                             },
             {
                                "name": "Value2",
                                "type": "LITERAL"
                            }
                        ]
                    },....

in  my code I have the following:
    var value1 = intent.slots[0];
    var value2 = intent.slots[1];

however when I try to run this both values are undefined. I also tried
    var value1 = intent.slots.Value1;
    var value2 = intent.slots.Value2;

But got the same result, they were both undefined. Does anyone know if this is indeed possible? and if so how would I get the values in code?

Thanks for your time

Re: Handling multiple slots in single intent
« Reply #1 on: October 28, 2015, 07:28:19 am »
Seems I had a mismatch in the JSON as I was sending an Array of slots, and this was not expected on the lambda. Removing the [] fixed it for me

Offline jwlv

  • *
  • 983
Re: Handling multiple slots in single intent
« Reply #2 on: October 28, 2015, 05:12:57 pm »
I have not seen much documentation on the data structure of intents.
But it would seem that you cannot nest them. That is, no multi-dimensional arrays.