How create drop down list from dynamic values

I don’t find intent name ‘inform’ every time after selecting drop down list value so I am not able to proceed further

Hey @Shweta_Mohite, I had used inform intent in this example just to showcase how to get the drop-down value. You can use any other intent where want to set the slot value.

hi @JiteshGaikwad I need your help !!!

buttons = []

    for t in accounts:

        facility_type = t
         payload = "/inform{\"facility_type\": \"" + facility_type + "\"}"
     
         buttons.append(
             {"title": "{}".format(facility_type),
             "payload": payload})
        
         message = {"payload": "dropDown", "data": buttons}

        dispatcher.utter_button_template("utter_balance", buttons, tracker)

    return []

and then by using form I’m able to assign button value to slot but now instead of buttons i want to use my cutsom payload- Drop down so using as follow i tried but its not working so can tell how i can achieve this please

message = {“payload”: “dropDown”, “data”: buttons}

dispatcher.utter_message(text=“Please select account number”, json_message=message)

hey @Shweta_Mohite, what’s the issue?

i am not able to assign selected drop down value to slot

hey @Shweta_Mohite, If you see I have created the payload data in this format can’t you create in this format? :sweat_smile:

@JiteshGaikwad I have database values so passing like this.

for (id, acc_no) in zip(ac_ids, accounts):

            data.append({"label": acc_no, "value": "/inform{'sname':" + id+"}"}) 

what wrong am I doing ?

hey @Shweta_Mohite, I have updated the code the some dummy values, test it out:

resp=[{"acc_no":"123","id":"abc"},{"acc_no":"456","id":"pqr"},{"acc_no":"789","id":"def"}]
data=[]
for i in range(0,len(resp)):
    data.append({"label": resp[i]["acc_no"], "value": "/inform{'sname':" + resp[i]["id"]+"}"})
    
print(data)    

Output:

[{'label': '123', 'value': "/inform{'sname':abc}"}, {'label': '456', 'value': "/inform{'sname':pqr}"}, {'label': '789', 'value': "/inform{'sname':def}"}]

no @JiteshGaikwad using this getting receive user message as ‘undefine’ for both drop down and button. I tried this with button

    for t in accounts:

        buttons.append({"title": "{}".format(facility_type), "payload": "/inform{\"facility_type\": \"" + facility_type + "\"}"})

Received user message ‘/inform{“facility_type”: “777772200491”}’ with intent ‘{‘name’: ‘inform’, ‘confidence’: 1.0}’ and entities ‘[{‘entity’: ‘facility_type’, ‘start’: 7, ‘end’: 40, ‘value’: ‘777772200491’}]’ but not working with drop down.any suggestion ?

hey @Shweta_Mohite, the payload which you are trying to send is button template and the dropdown doesn’t supports that.

can you show the output?

hey @JiteshGaikwad please check

hey @Shweta_Mohite, did you check the slot value of facility_type(check it in custom action) and have you registered the slot name facility_type in your domain.yml file?

Hi. Thank you for this repo. I wanted to ask if you could show a snapshot of:

  1. your domain yml file featuring the slot “slot_name” and the intent “inform”
  2. your stories file featuring the story that triggers the dropdown and the inform intent
2 Likes

Hi.

Right now i am using rasa utter template to populate the message with lists(ordered list) with the help of below(in domain.yml):

text: "Here is your data: \n - requirement: \n - mockup: n - url: \n - timeline:
\ \n - budget: \n - name: \n - email: \n - phone:

Result is in unorderd list like below:

Here is your data:

  • requirement:
  • mockup: n - url:
  • timeline:
  • budget:
  • name:
  • email:
  • phone:

but I want output in ordered list like below with the help of domain.yml:

Here is your data:

  1. requirement:
  2. mockup: n - url:
  3. timeline:
  4. budget:
  5. name:
  6. email:
  7. phone:

can any one help with these?

Thanks

Hey, can anyone share the solution for this issue? Even I am not able to assign custom actions to the dropdown options. Please help.

Hi @nik202 , I’m trying to send data as json message from my custom action to my front-end code like this

How can I retrieve this info in my frontend code? The frontend code is simple JS -

@Horizon733 if you could also help me out with my above post in this thread then it would be a great help! Thanks in advance

@webdev-rohit what does this data looks like or do you want to look on the webchat screen? this is not the ideal method to send the data.

@nik202

this is the data, what I really want is that if I could create a card from the frontend and show this data in it. My frontend code is the one shown in my post sent earlier. I tried sending data via the custom action-carousel, but it doesn’t display it properly in the webchat.

@webdev-rohit is this related to the drop down or main post? You want that using card crousels, If yes please create the new post and tag me there.