Hi i was trying to store a list to firebase using the blocks below. If i use the cloud variable, it stores fine in the firebase (see last image), but i also want to detect any error so i prefer to use the realtime blocks.
However, when i use the realtime blocks (See 2nd image), automatically an item _scopevariableinfo gets added to the list and block further actions to the list (see 1st image)…not sure why…
Lock the list is due to incorrect index. Your structure root ClansList is an array of objects. And to access the array elements using numeric indices. But in the second image instead of a number index you add the text in root ClansList. Therefore, block further actions to the list.
Sorry i don’t fully get you.
i understand app ClansList is a list. I’m adding the list as a value to the key ClansList in Firebase, is that not allowed? But if so, why is the third image ok because i seem to be doing the same thing just using cloud variable instead.
@Zhou_Sicong, You have hit upon a bug in Thunkable, whereby ordinary list operations do not work on lists that are obtained from the Realtime DB component. Until it is fixed, I will suggest a workaround. The basic idea of the workaround is to copy the list that you obtain from the Realtime DB component. Unfortunately, you can’t use most of the normal list operations to do do that, for example, the length of block. So, what you’ll need to do is to save the length of the list the Realtime DB component along with the list itself and use that length to copy the list after you retrieve it from the Realtime DB component. Then you can use that copy with ordinary list operations.
As an example, here is a very simple example project that uses the technique suggested above: Thunkable
And here is a screenshot of the blocks in that project:
I’ve had issues with lists while using cloud variables and realtime db.
What I have done is store the list as text on the cloud var/realtime db and convert it back and forth with the make list from text and make text from list blocks.
Ah yes, @actech, that’s an even better approach than mine! I would just suggest putting the blocks in the 'then do' into a function, so it could be used in other places (i.e. with other 'RealtimeDB call Get' blocks).
Hi. I realized recently this is a big problem when working with firebase / Thunkable. The issue is that a list gets converted into a set, and the _scopeVariableInfo gets added. The simplest solution I’ve found to this is that every time You update, get rid of the _scopeVariableInfo by saving not the list, but the list, with the last entry omitted, so in the value, don’t use ‘app ClansList’ but from the list drawer use the 'in list ___ get sublist from #1 to …" and put a minus block from math in, and create ‘length of ClansList -1’. This will eliminate the last entry in the object created (ie. _scopeVariableInfo), and create a list which is not an app variable, resulting in the save to be an array. See below:
We’ll continue to support them in legacy projects @jared, but at the moment - if you’re creating a new project then yes, we recommend that you use cloud variables for this.
@tuffla - would cloud variables work for your particular use case?
Sir Can You explain a thing sir i am using free thunkable and it has 10 projects and i still can create projects i didn’t upgrade to pro i am sure about this