How can i search in firebase by different fields?

Check this:

image

Regarding to the other problem "it always downloads in the labels the last one, the rest NOT.".

When you get the data from the Initialize block, you are receiving all the data in GotText, and setting the three labels with the info....for each element you are overwriting the labels...so only the last one remains... is this what you are referring to?

@Ramon

where is that from ?

He is checking the rules in "Rules playground" in firebase, and it didn't work for me there...but it works if I add that

if I do that, it allows me to pass the rules, but it does not hold and the app still does not search for anything.
thanks

image

Assuming "recambios" is a top line node:

https://yourProjectName.firebaseio.com > recambios

image

your rules should be (and you should be able to publish):

{
  "rules": {
      "recambios": {
         ".read": true,
         ".write": true,
         ".indexOn": [".value","Compatible","Descripcion","PN"]
       }
   }
}

(if you have any other rules set up, then show these as well)

error rules :

database

move read & write rules out of "recambios" if not, then you have to put /recambios when you are testing your rules in the "Zona de pruebas".

@TIMAI2 Did you test your example? It doesn't work for me, it seems like the index are at "recambios" level and "Compatible" tag is nested one level more....

Yes, I tested it.

Firebase handles the nesting.

PN
image

Compatible
image

image

rules as above

yeeess It finally works for me

:rofl: :rofl: :rofl: Sorry David, but I was also frustrated

David, Do you have still the same error?

I see double quoted in your values...maybe you will need \" in the beginning and end of your query value (in equalTo statement)

perfect ramon modifying equalTo works fine.

do you know why it is saved with that double " feature?

thanks in advanced both

how are you saving the data?

Are you both going to write a rule for every single key?

What do you mean?

OK, two things going on.

  1. The positioning of the rules
  • You should not need to write a rule for every key in the node recambois. Just as I have shown.
  1. The double quotes around the values
  • If you use the experiemental firebase component to add records to your database, this will add a set of double quotes. Use the web component to add records.
  • or if using the experiemental firebase component, add double quotes as another set to the textbox.text ?

Thanks for the explanation,

if I use firebase component in App inventor, knowing that it uses double quotes, there is no problem .

For my part, I close the query by thanking you again for your help.

after getting it to search by " compatible " thanks to your indications, now I find a new problem, when there are two or more words it is not able to search, not even if you put both words... is there a solution or is it not possible to do that in firebase?

thanks in advanced

It is not really possible to carry out wildcard / partial string searches in firebase. There are some hacks, but I do not believe any of the ones I have seen will handle your requirement. To do it, you will need to restructure your data, I have a couple of ideas, but will have to carry out some testing....

many thanks Timai2