[Solved] Firebase _ScopeVariableInfo cloud variable error notification

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…

Hi,

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.

But thank you for your response!

@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 hope this helps.

-Mark

2 Likes

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.

3 Likes

I think the problem may also lies with using an If block within the realtime db get block.

I was able to execute all the lines of codes correctly if i pull them out of the if block separately.
image

I also check that the if condition return a true separately.

Yet when i put the above two together, they don’t execute.

1 Like

The problem associated with the use of global variables. Suppose we have a numeric list of three items 1,2,3

If the list is stored in the variable function, the list of preservation takes place when it is stored in Firebase

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

, and upon receipt we will see:

[1,2,3] - this is the list. That is, a list of saved correctly

If the list is stored in a global variable, then when you save it in the happens Firebase object preservation:

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

For get a list, you can use these blocks:

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

4 Likes

O awesome, i think it will solve my problem! Thanks so much!

1 Like

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).

-Mark

1 Like

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:

When You save, not update, use the length of the list itself.

1 Like

Using the cloud variables is an easy workaround for the issue you describe.

This problem has been solved! Eventually the Firebase blocks will disappear I’d imagine!

2 Likes

We’ll continue to support them in legacy projects @nradjt74jatz, 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?

1 Like

Try this:

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