Skip to content Skip to sidebar Skip to footer

How To Check If A Tinydb Tag Has Any Attributes In App Inventor

I need a little help with an issue in App Inventor 2. The case is that I have a JSON result that is parsed, and then have it stored in a tinyDB tag as a list (storeparseData). Pro

Solution 1:

This looks very strange... a complicated if then else structure, loads of empty sockets and your comparison if "storeparsedData" = <empty string> always will be false... obviously this does not make sense...

it looks like you are thinking too complicated? what about this:

enter image description here

As already recommended in my answer to your other question you should learn how to work with lists...

Also doing some more tutorials might help to learn some more basics...

To answer your question "Can you explain why you've chosen to create an empty list there.": if you are working with lists as in the example and you are trying to read a list from TinyDB, then you also have to think about what should happen, if that tag is not available in TinyDB (for example after starting the app the first time). And for lists, in this case an empty list should be returned. Note: the is list empty? block always expects a list. If you set valueIfTagNotThere to an empty string, then you will get a runtime error...

Solution 2:

You can use Clock function to delay the time. Firstly, just set the global DelayCountdown to specific number in "when Screen1.Initialize" part. Then, by using "when Clock1.Timer" function, you just need to add another check whether the DelayCountdown is equal to zero before you do another function.

enter image description here

Post a Comment for "How To Check If A Tinydb Tag Has Any Attributes In App Inventor"