# When I use \[for each item\] to extract a value, I don't get the first value right away

**URL:** <https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894>\
**Category:** Questions about Thunkable X\
**Created:** [January 15, 2020, 6:52pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894 "2020-01-15T18:52:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mom7667yafy](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@mom7667yafy](https://community.thunkable.com/u/mom7667yafy)\
**Post date:** [January 15, 2020, 6:52pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/1 "2020-01-15T18:52:57Z")

</div>

![스크린샷 2020-01-16 오전 3.35.06](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/5/a5fb4e546fbebd9079d61b8cddcb01de875dac70.png) ![IMG_8333](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/1/913fbcb7d49fb9942c80d14616bef069b63719d3.png)

[https://x.thunkable.com/copy/01db7549a963d739e02ab15541688bdd](https://x.thunkable.com/copy/01db7549a963d739e02ab15541688bdd)

I made a block as above.  
I want to get [1,1,1].  
However, the value comes as [, 1,1]  
How can I get the value [1,1,1] ?

---

<div class="post-metadata">

**Author:** ![mom7667yafy](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@mom7667yafy](https://community.thunkable.com/u/mom7667yafy)\
**Post date:** [January 15, 2020, 7:54pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/2 "2020-01-15T19:54:55Z")

</div>

![스크린샷 2020-01-16 오전 4.41.52](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/c/bc0a6eba555b33f5c28d0eb2142a400544763757.png)  
I solved it using a label instead of a variable.  
Is it a bug not to use variables?

I hope to let you know if there is a better way.

---

<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:** [January 15, 2020, 8:09pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/3 "2020-01-15T20:09:10Z")

</div>

I believe a storage key has to be a text string. But you are using a list of integers and then setting the key to an item in that list. So you’re trying to get a key that is an integer, not a text string.

---

<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:** [January 15, 2020, 8:14pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/4 "2020-01-15T20:14:16Z")

</div>

You can either change your list to text strings (“1” and “2” and “3”) or you can join the integer values with an empty string (""):

![Screen Shot 2020-01-15 at 12.02.58 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/a/3a99dc56aabac1d25f6fa4d5661c58d71a4a4552.png)

This method is discussed [here](http://community.thunkable.com/t/convert-number-to-text/389546/2).

---

<div class="post-metadata">

**Author:** ![mom7667yafy](https://avatars.discourse-cdn.com/v4/letter/m/e19b73/32.png) [@mom7667yafy](https://community.thunkable.com/u/mom7667yafy)\
**Post date:** [January 15, 2020, 8:25pm UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/5 "2020-01-15T20:25:51Z")

</div>

That doesn’t work  
But it was helpful. Thank you.

---

<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:** [January 16, 2020, 12:07am UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/6 "2020-01-16T00:07:01Z")

</div>

Well, your keys have to match the keys in the Get call. So make sure you are using text strings for the keys when you save them AND when you get them.

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 16, 2020, 7:49am UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/7 "2020-01-16T07:49:03Z")

</div>

You are not using the asynchronous purple block correctly, which is why errors occur. I recommend that you deal with their work - [http://droidscript.ru/main/statyi/thunkablex\_base7.php](http://droidscript.ru/main/statyi/thunkablex_base7.php), otherwise you will have problems with purple blocks all the time.

---

<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, 11:45am UTC](https://community.thunkable.com/t/when-i-use-for-each-item-to-extract-a-value-i-dont-get-the-first-value-right-away/409894/9 "2024-11-08T11:45:59Z")

</div>


