I want to connect a firebase to my project. Its a list of food that include Title, Image and Detail. After i followed the tutorial, I just test it to random a food Title. But it say that there are nothing in the list. Did I do anything wrong? Thank you!
Here are my block and database:
Check what you get in the value variable. Display raw data e.g. in a label.
Ok Sir, Im tried it. When im hit the button dislike, it will set Label1 to a random item on list "global Title". But it said "Pick a random item: Pick a random item on an empty list" What does this mean?
Ramon
February 29, 2024, 4:04pm
4
When you are requesting for tag, the response you get in a list with the tags, that means Food1, Food2, Food3:
You can get the value of each item in that list and in GotValue block, make the lists.You will get for each one the 'Detail', 'Image' and 'Title' fields.
1 Like
The list isn't being populated; that means the if condition in the FirebaseDB1.GetValue event isn't being satisfied.
TIMAI2
February 29, 2024, 4:07pm
6
This is not the best way to do things
leave your project bucket as List
and get your items:
tag: join: Food & number / Title
tag: join: Food & number / Image
tag: join: Food & number / Detail
1 Like
Ramon
February 29, 2024, 4:13pm
7
well I was supposing the projectbucket like 'List'...I didn't see that project bucket.
anyway, I agree that your method is more direct, but mine would also work, right?
Sorry Sir, Im really new to the app inventor and firebase. Is this what you mean?
Ramon
February 29, 2024, 4:26pm
9
set the projectBucket to 'List'
I following your step sir, but unfortunately it doesn't work. Did im do something wrong?
Ramon
February 29, 2024, 4:44pm
11
Get the value for the tags:
1 Like
Thanks for your help sir, but it still said that it is an empty list. What should i do?
Ramon
February 29, 2024, 4:55pm
13
First, move this to Initilize block,
before the call to get Tags. Then check in "TagList" block, if you are receiving in 'value' a list with "Food1, Food2, Food2".
If that is correct, then check in GotValue, in 'value' parameter, what are you receiving.
Sir, How to check in "TagList"? Thank you.
Ramon
February 29, 2024, 5:04pm
15
use a label to set it to value and be able to check it...something similar to this:
Many developers often get stuck when trying to handle the response content from an online server after making a GET request using the web component. Those trying to help often ask to see the raw responseContent being returned. When using companion this can be copied and pasted to the community for those trying to help to use with debugging. This is how you might return that information / data to a label.
BLOCKS
[image]
DATA
Do It Result:
""Name","Date of Birth","Age"
"Adah","06/04/1999","2…
Sir, In TagList i got ["Food2","Food3","Food1"] and in GotValue i got "asd".
Ramon
February 29, 2024, 5:12pm
17
that's right...the problem maybe is that your tags now are not "Title", but "Food1/Title"
Sir, it worked. But it only worked when im write the tags as "Food1/Title" , "Food2/Title" . Does there anyway that im can store the tag as Food/Title so i don't have to specific it for every item in list?
Ramon
February 29, 2024, 5:19pm
19
you can use this less restrictive condition:
which will met for the three title tags.
ABG
February 29, 2024, 5:37pm
20
May I suggest a more workable tag/value structure?
list
ostrich_eggs
Title:"Ostrich Eggs"
Image:"ostrichEggs.jpg"
Detail:"Only available in Australia"
rat_milk
Title:"Rat Milk"
Image:"PizzaRat.png"
Detail:"Only available in NYC Subway stations"