GetTagList does not seem to work

Good evening everyone! I am having trouble getting the tags in one of my databases. I am trying to execute the block GetTagList, and it does not seem to execute for some reason. Here is the code I am using:

And here is the database:

I have been trying to search for a solution and I wanted to clarify some things:

  • I know that the "GetTagList" block might not execute when the database is empty, but this one is not. I can get values from it and, from what you can see in the sceenshot of the database, it is clearly not empty.
  • The notifier is simply for debugging purposes.
  • I do not think it is relevant what the code does. The problem is that the code inside the "When Tag List" is not executed at all.

I hope someone can lend me a hand. I would be more than glad to provide more details if needed. The error might be something really stupid, but I seriously can get to find it. Thank you in advance!


Please export your project and post it here.
We need to check your database components.

I am sorry for my ignorance, but If I share my project here, would my firebase token be visible to whoever downloads it? And wouldn't that imply a security problem for me? Thanks for answering, by the way!

Unfortunately, yes.

I usually make different databases, one for test and one for production.

Is there any way we can avoid doing that? Maybe I can send you another screenshot instead? I am really cautious regarding my personal information.

That's the nice thing about test databases.
You can fill them with garbage.

Hello Ignacio

Here is a hunch - you are trying to list the tags via a Screen Initialisation Block - I think the Screen probably hasn't finished initializing when you do that. Try moving it to a Clock Timer that allows the initialization to complete first:

By the way, use smarter component naming so that your code is readable by retaining the standard component type name. See:
https://www.professorcad.co.uk/appinventortips#TipsGui

I actually thought of that, so, just to check if it was a timing problem, I put the Get Tags Block to execute after clicking a button rather than when initializing the screen. Something like this:

But even then, I could not make it work. Do you think I should still try using a Clock Timer?

I appreciate the advice regarding the component naming, I was wondering if there was an standard for App Inventor. Thank you for that!

You need an if/else statement in your firebase gotValue event block to handle the different tag calls. You are not checking for the usarios tag value anywhere....

I tried a direct Do It on the productos.GetTagList and rigged the GotTagList event block to send its list of values into a global List. The List never changed. I also added Firebase error catcher blocks, with popup messages requiring an OK to proceed.


This confirms the taglist received event never fires:

For what it's worth, your ElementsFromString loading (circled) is premature. The individual tag/values have not had a chance to arrive to fill that global variable.

I'm stumped.

In AGB's example above, the global "productos_taglist" should be initialised as an empty list rather than a string I think.....

I originally had it that way, when I added it for Do It debugging.

But then it occurred to me that I would not be able to differentiate between receiving an empty taglist vs never getting a taglist at all (event never firing.)
The Do It results against the global variable would both be empty list.

This initialization value would let me differentiate between the two cases, in this case proving that the Got TagList event never fired.

There was a method to my madness.

P.S. In primeval programming days, when debugging was done by poring over memory dumps, programmers would initialize unused swathes of memory with the hex pattern 'DEADBEEF' to allow them to easily spot unexpected memory corruption by errant data accesses.

As another aside, I think this sort of Project would benefit from using Virtual Screens.

Yes, you need to give your real App time to initialize, hence my example Blocks.

Another tip is to keep your code Blocks tidy and logically arranged - it's very difficult to follow your code.

It's now "VEGETABLEPATTY" :joy:

Could it also be confirming that the taglist is not there? A simple typo in a name?

I checked bucket names, maybe missed something.

I am at the point of grabbing straws, like

  • Did the OP lock down his database in its security rules so much that it returns nothing?
  • Did the OP annoy Google by hitting on his database so much that Google won't answer his requests for a while?
  • Is the database just empty?

All the above require the OP to look for us.

Yes indeed - can you go through all points mentioned Ignacio (you are the OP).

TimAI2 has some excellent material on Firebase:
https://sites.google.com/view/metricrat-ai2/guides/how-to-have-secure-rules-on-firebase-and-allow-auth-users-to-readwrite?authuser=0

I am sorry I have not been answering, I have been following the discussion but I can not add much honestly; I am quite lost. Regarding what ABG asked:

  • Did the OP lock down his database in its security rules so much that it returns nothing?

I modified the rules when I created the projects, but they are only defined as public. Here you have a screenshot:

image

I know this is completely unsafe, but it is just a database for a school project and it made my work easier.

  • Did the OP annoy Google by hitting on his database so much that Google won't answer his requests for a while?

I do not think that is the case if I am honest, because I am only having problems retrieving those tags. I can get the values for those keys using a Get Value, it is just that particular block of code that does not seem to work.

  • Is the database just empty?

It definitely is not. I posted a screenshot earlier with its content, and, as I said, I can retrieve that data.

Another tip is to keep your code Blocks tidy and logically arranged - it's very difficult to follow your code.

I will definitely address this, I am just very new to this tool and I am still getting use to using blocks instead of code. I appreciate the feedback and the time you're spending on helping me, I really do!

.... we can all see you have got a long way in a short time, so it's interesting to try to find the bugs with you.

1 Like