here as you can see the screenshot am trying to collect inromation from the user…if i want duration to put in that fuction how can i do that?
The dispatcher is only for sending messages.
It is possible to store the data in a database, but it is necessary to use a specific lib for this. For example: to work with mongodb, you can use pymongo lib.
store the duration in slot the same way you did for the other slots.
getDataDep(tracker.get_slot(“department”),tracker.get_slot(“doctor”),tracker.get_slot(“name”),tracker.get_slot(“email”),tracker.get_slot(“duration”)) if i put it like this wont the slot be 2 instade of second?
All custom action code is executed in the actions terminal.
Your variable entity_val is of type int, you need to convert it to string before sending. Use str (entity_val) to convert it.
I did not understand your problem with the form. Could you explain me better?
Okay
Assume you are collecting user information and storing it to a database…in rasa for collecting user info you do formfillig…and what I did was I did formfilling and the slots are filled and then I called another action in series.yml file after the form is finished then that action if you see in the screenshot will collect all those filled slots then store it to a database… I did database connectivity in another .py file then called a function getdeptdata() to collect the slots and store it to database
@brunohjs hey there can u help me solve this…i want the display in a table format but the dispaly is in a sentense how can we do in a html table format
I don’t know if it’s possible to do it in a table format. This code will display in list format. Replace lines 235-243 with this code:
tbl = "here are the available nurses: "
dispatcher.utter_message(tbl)
for k in department_data:
dispatcher.utter_message(k[0])
Okay thanks I will try it
@brunohjs i tried it but the output become like this …am trying to make an output for firstname and last name but i dont know what happen to the loop it gives me output for first and for second one both the first and second
You do not need to create a variable department_response just to store the response. Delete line 240 and 242 and edit line 243 like this:
dispatcher.utter_message(f"{k[0]} {k[1]}")
The dispatcher is called whenever a bubble needs to be printed.
Do you want the names to be displayed in the same bubble? If so, you can use that variable department_response:
department_response = ""
for k in department_data:
department_response = f"{k[0]] {k[1]}\t"
dispatcher.utter_message(department_response)
the output will be like this:
Meselech Ayele Nuritu Mesfen
You can replace the \t by \n to break line in the same bubble.
@brunohjs i have two names “meselech ayele” and “nuritu mesfin” in the database but it only outputs the second one which is “nuritu mesfin”
Oops, I forgot to put a +
department_response = ""
for k in department_data:
department_response += f"{k[0]] {k[1]}\t"
dispatcher.utter_message(department_response)
















