I can't get my score data

hello , as you can see, I cannot receive my score data, why is this happening?

FirebaseDB. GetValue, set valueIfTagNotThere to empty list

Your FirebaseDB2 returned a value that was not a list.

In the two circled blocks,

the first is expecting a dictionary, and

the second is expecting a list.

There are blocks that can be used to test of something is a list, 'is a list'.
Use it to test your returned FirebaseDB2 value, and if it is not a list use a Notifier to show the tag that returned the value.
(We already see in the FirebaseDB1.GotTaglist event that you are asking Firebase DB2 to get values for some JOINed tags, and that you want "" returned if the tag is not there. You got what you asked for, blank text.

It is better to ask for a Create Empty List as a default value, if you are going to rush into treating that returned value like a list.

It gets even worse.

You are asking for two different levels from the FirebaseDB2 data tree,

  • one higher level, and
  • one low level (.../puan) that should just return numbers.

but you don't test the tags when the data arrives to see how you should treat the data.
Does the tag contain '/puan' ?

Come to think of it, it is easier to just ask for the root of the tree, and accept the result as a dictionary with all the scores as subdictionaries.

It's not like you're running FortNite.

and worse. :cry:

NEVER return to Screen1 this way.

Instead, just close the screen you are on with the close Block and your app will return to Screen1 without taxing your apps memory. Simply, do not use the open another screen Block to return to Screen1.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps

How to do a lot of basic things with App Inventor are described here: How do you...? .

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here http://www.imagnity.com/tutorial-index/ for more tutorials including Imagnity.com List Tutorial, Mirrored - @Saj

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

Ok, I tried to do what you said, I hope I succeeded.
I can get my score data. I even set a score data to 78 to test it and the values ​​came. I wanted to combine these data with their tags (usernames) and create a list, but some values ​​are extra, why?

WhatsApp Image 2023-12-31 at 09.24.00

See here

I guess this isn't quite the answer I want. I'm already pulling the score data but I think I'm doing something wrong in the for loop. There should be 1 Ahmet tag, but there are 3 of them. These should happen one by one. I want to make a list consisting of usernames and scores, sort the score data in my score list from largest to smallest with the extension used to sort the data in the list I received from the forum, and then index that data and pull the data from the list of names and scores with those indexes and create a top 5 ranking table. But I don't know why, but Ahmet's value is 3, Ömer's value is 2, they all need to be one.

Export your .aia file and post it here, to make it easier to show solutions.

proje.aia (16.0 KB)


1 Like


This is what I got from a copy (Screen4) of the Screen2 database component's bucket:

proje1.aia (18.9 KB)

with debug of the tree:
proje2.aia (19.0 KB)

Wow, I didn't even know half of the list codes here, thank you very much, my project is finished.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.