Getting specific results from a Table in the Knowl...
# 🤝help
t
I am trying to fetch specific data from a table in the knowledge base. My table in the KBhas multiple columns 'Name' 'Setup', 'Experience', 'Status', 'Whatsapp Number'. I need to return a list of 'Name'(s) and 'whatsapp number'(s) from the table knowledge base when the user enters values that match that row. eg: User enters: Experience: 5, Status: A-list, Setup: Solo. I need to return only those results that match this criteria. I have saved the users inputs into variables and am querying the knowledge base with these variables BUT I'm getting very inconsistent results in my output. Mixed results that sometimes match all the inputs and sometimes do not. I have checked to see if the variables are being passed and they are. Adding my query for reference. This is what my query looks like: Setup = @workflow.artistSetup Genre = @workflow.genre Status = @workflow.status Experience Years = @workflow.experience Return the 'name' and 'whatsAppNumber' for each of these results. Return the results in JSON format On a side note I also need to write the query so 'Experience Years' returns all the result that are greater than or equal to the number eg:(>=8). How can I write this query. I looked for resources relating to this but was unable to find anything which is why I'm posting here. Any help or resources you can point me to would be much appreciated. Thanks
r
Hey @thankful-insurance-9424 , did you look into our Tables feature for this use-case? Tables are best suited for searching on structured data, as KBs are unstructured and can't filter documents or content based on JSON payloads. When you upload your JSON data in a Botpress Table, you can then use the Filter operation to filter on specific column values. (you can do this using a findRecords card or inside an Execute Code Card). https://botpress.com/docs/cloud/studio/tables/
t
Oops, I overlooked this bit in the docs. It seems to answer all my questions about querying the DB. Thanks for your help @rich-battery-69172
2 Views