# "WAIT x seconds" control

**URL:** https://community.thunkable.com/t/wait-x-seconds-control/1329133
**Category:** Questions about Thunkable X
**Tags:** beginner
**Created:** [June 6, 2021, 9:14pm UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133 "2021-06-06T21:14:20Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [June 6, 2021, 9:14pm UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/1 "2021-06-06T21:14:20Z")

</div>

This is my 1st post, so please be gentle with me 🙂  
Im trying to understand the basics of this.  
Why is “wait 1 sec” in my example important for a correct result ?  
Basically, i have 2 lists (list1 and list 2)  
Im using list1 to get values from Firebase with a loop, then with these i populate list2  
This works just fine only if after loop i insert "wait "… Why is that ? Thank you.

 ![screens](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/c/dc1032afefa42c5e92d6893c7660365f4d5aa2dc.png)

---

<div class="post-metadata">

### Author: ![human](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/human/32/101416_2.png) [@human](https://community.thunkable.com/u/human)
#### Post date: [June 6, 2021, 9:27pm UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/2 "2021-06-06T21:27:02Z")

</div>

I think the wait block gives Thunkable more time to get the property of the object and populate the list.

tatiang, muneer, catsarisky, and others will give you better answers since I’m not the expert on this.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [June 7, 2021, 5:30am UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/3 "2021-06-07T05:30:15Z")

</div>

The short answer is:  
If you move the `label_admin` as last item in the `then do` block of the database, you will not need the wait block.

The answer is that purple blocks in Thunkable are **asynchronous** blocks in nature. What does that mean? It means these blocks receive you command and work on it but will not **halt** your app until data is received but will allow the next command to execute (in your case, the `label_admin` will show nothing because the `Get` block is still busy.

You can switch your code to use `cloud variables` instead of the database blocks. `cloud variables` are **synchronous** in nature which means the block will first get the data before allowing the next block to execute.

Advice  
In your code, you are looping through a list and inside the loop you use the database block. Reading from external sources is much more slower than normal block operations so as a workaround, read the whole block of data at once and save it to a variable then loop through the variable which is faster on one hand and on the other hand it would be cheaper if the access to the database is charged.

---

<div class="post-metadata">

### Author: ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)
#### Post date: [June 7, 2021, 5:44am UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/4 "2021-06-07T05:44:03Z")

</div>

> [@muneer](#):
>
> **asynchronous**

is the key that answers my question. My example is purely a simplifying thing of what i have, that is more complicated, so all other things dont apply.  
Cant use cloud variable, as multiple users can be online at the same time, and will have acces at same “cloud” variable… and will be a mess :).  
So my next question is: That "1 seconds as "wait"parameter works at this moment, giving suficient time as cloud database isnt much populated right now. But what will happen later… Is there a way to check and wait “until” datas are retrieved from cloud ?  
Thank you for your time.

Later edit:  
This can work ?

 ![screen](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/0/805ba24831639b4a11792c4613e0cbd7f451d895.png)  
or will exit loop even if not the entire list is populated, giving incomplete answer then ? (as i assume)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [June 7, 2021, 5:48am UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/5 "2021-06-07T05:48:35Z")

</div>

> [@mimostel](#):
>
> Cant use cloud variable, as multiple users can be online at the same time, and will have acces at same “cloud” variable… and will be a mess :).

You can actually. Firebase data retrieved using cloud variables can easily handle unique data for each user. Each cloud variable can refer to a separate Firebase node. I’ve set up my Photo Journal app this way.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [June 7, 2021, 6:23am UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/6 "2021-06-07T06:23:17Z")

</div>

If you see using database blocks is unavoidable then you can do something like this

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/d/3d2b922ee644fac91d00114db3d76097b5883b0d.png)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:20pm UTC](https://community.thunkable.com/t/wait-x-seconds-control/1329133/7 "2024-11-08T13:20:25Z")

</div>


