0

enter image description here

I want to check weather string i have is substring of Treats field and if yes then how to retrive data of remaining fields and display it. i want to do this for all doctors.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • The Firebase Database doesn't support queries that search for a substring. If this functionality is required for your app, consider using another/additional service. See https://stackoverflow.com/questions/51452823/it-is-possible-to-have-a-contains-search-query-in-firebase and https://stackoverflow.com/questions/28589092/firebase-query-find-item-with-child-that-contains-string – Frank van Puffelen Feb 21 '19 at 19:09
  • how to integrate elasticsearch in dialogflow? – Rohan Atale Feb 22 '19 at 05:55

2 Answers2

1

You would have to loop through each doctor and check if your string is a substring. Save each doctor that has your substring and display the rest of their data.

andrewjazbec
  • 859
  • 8
  • 20
0

After setting up firebase for your project and adding all of the SDKs (if you haven't done that yet, do that here), you can retrieve data by using this:

for(var i = 0; i < 2; i++){
var postId = i
var findTreat = firebase.database().ref('Doctor/' + postId + '/Treats');
  findTreat.on('value', function(snapshot) {
  updatefindTreat(postElement, snapshot.val());
});
}

I found this using the firebase docs. Let me know if this works!

Darrow Hartman
  • 4,142
  • 2
  • 17
  • 36