tosto73bs

unread,
Jul 10, 2014, 10:50:34 PM7/10/14
to mitappinv...@googlegroups.com
I run when I open a screen to load all the data in a TinyDB component but leaves the following error: 

Bad argument list to foreach 
toforeach the second argument is not a list. the second argument is: * empty-string * 

I attach screen block that generates the error 

thank you
forum1.JPG

Stephen Zipprich

unread,
Jul 11, 2014, 4:39:41 AM7/11/14
to mitappinv...@googlegroups.com
Is "Preferiti" actually saved as a list?  This is probably what is causing your error.  Since it's supposed to be a list, you should change the empty text block in the value if tag not there portion to be an empty list (create empty list), so that you don't run into errors, especially since you said you're doing this on screen load.

tosto73bs

unread,
Jul 11, 2014, 4:47:45 AM7/11/14
to mitappinv...@googlegroups.com
I did not understand your answer, TinyDB tag except that the list is called "Favorites," you can give me an example here of how I should do to not having the error on the loading screen? 

Thank you.

tosto73bs

unread,
Jul 11, 2014, 5:16:48 AM7/11/14
to mitappinv...@googlegroups.com
I attach the modified code image

I modified it so, on opening the screen to check the variable "listatemp" the content of tibydb then if this variable "listatemp" is not empty then skim the elements with foreach, but now I get this error: 

Bad arguments to list is empty 

The operation list is empty? 
Can not accept the arguments: * empty-string *
forum2.JPG

tosto73bs

unread,
Jul 11, 2014, 5:30:48 AM7/11/14
to
Presumably some work so had remained empty element within the TinyDB of my phone now I have added a control that adds an element only if it is not empty so not going the error thanks to all for your cooperation

Taifun

unread,
Jul 11, 2014, 9:16:10 AM7/11/14
to mitappinv...@googlegroups.com
for list variables, the valueIfTagNotThere of the TinyDB.GetValue block should be create empty list instead of an empty text block
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Reply all
Reply to author
Forward
0 new messages