# Loops and variables and spreadsheet blocks

**URL:** <https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836>\
**Category:** Questions about Thunkable X\
**Created:** [August 19, 2019, 5:43am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836 "2019-08-19T05:43:17Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 19, 2019, 5:43am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/1 "2019-08-19T05:43:17Z")

</div>

[BLOCKS](https://x.thunkable.com/copy/53c225f310a48d76587ed6a71488bbd2)

I WANT TO DO APP WHICH RETRIEVES ONE COLOUMN OF DATA OF LATTITUDES OF 8 LOCATIONS FROM AIRTABLE SPREADSHEET AND STORES IT INTO ANOTHER SPREADSHEET WITH VARIABLE VALUE BUT WHEN I EXECUTE THE APP EVERY TIME IM GETTING DIFFERENT SEQUENCE OF VARIABLE VALUES

 ![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/b/ab4eb6b551d640d5bf3668d9c5d2ebad55270827.png)

---

<div class="post-metadata">

**Author:** ![renren66](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@renren66](https://community.thunkable.com/u/renren66)\
**Post date:** [August 19, 2019, 6:14am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/2 "2019-08-19T06:14:19Z")

</div>

First of all, welcome to the community!

Regarding your question, you can try changing the variables to app variable instead of stored variable, as the value of stored variables will persist after the app has closed.

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 19, 2019, 6:33am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/3 "2019-08-19T06:33:05Z")

</div>

but i have used app variable also see the result

 ![Capture%20app](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/7/6708c1762f398596bc67476978dc8725ced88c0f.png)

---

<div class="post-metadata">

**Author:** ![renren66](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@renren66](https://community.thunkable.com/u/renren66)\
**Post date:** [August 19, 2019, 6:38am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/4 "2019-08-19T06:38:04Z")

</div>

> [@aelinespodiliho](#):
>
> but i have used app variable

I mean the counters i and j

 ![Capture(19)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/1/b1d5e339a1964d8ddc2291c9e9d0397ce27f2fb8.png)  
(This is taken from your project 🤔🤔)

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 19, 2019, 6:46am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/5 "2019-08-19T06:46:23Z")

</div>

no no i changed that stored variables to app variables and checked but still having wrong results shown above

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 19, 2019, 12:29pm UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/6 "2019-08-19T12:29:57Z")

</div>

pls give solution to this programme its giving wrong variable sequence when executing no of times

---

<div class="post-metadata">

**Author:** ![renren66](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@renren66](https://community.thunkable.com/u/renren66)\
**Post date:** [August 20, 2019, 2:46am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/7 "2019-08-20T02:46:12Z")

</div>

Can you send me an updated version of the project? It’d be better to troubleshoot that way.

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 20, 2019, 4:30am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/8 "2019-08-20T04:30:28Z")

</div>

this is my updated project[![Capture%20app](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/7/6708c1762f398596bc67476978dc8725ced88c0f.png) ](https://x.thunkable.com/copy/7911f294129425ca0667fd641326bf62)

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 20, 2019, 11:19am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/9 "2019-08-20T11:19:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aelinespodiliho](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@aelinespodiliho](https://community.thunkable.com/u/aelinespodiliho)\
**Post date:** [August 21, 2019, 5:51am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/10 "2019-08-21T05:51:04Z")

</div>

hi guys i need help from u  
i have airtable spreadsheet having data related to 10 locations of poles (Lattitude, Longitude, No of pole, name of pole, type of pole)  
i want to get row and make a list with that how to do ?

---

<div class="post-metadata">

**Author:** ![renren66](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@renren66](https://community.thunkable.com/u/renren66)\
**Post date:** [August 22, 2019, 2:00am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/11 "2019-08-22T02:00:05Z")

</div>

> [@aelinespodiliho](#):
>
> i want to get row and make a list with that how to do ?

Do you want a list of sub-lists containing the data or a list containing the row objects?

---

<div class="post-metadata">

**Author:** ![renren66](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@renren66](https://community.thunkable.com/u/renren66)\
**Post date:** [August 22, 2019, 2:02am UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/12 "2019-08-22T02:02:36Z")

</div>

> [@aelinespodiliho](#):
>
> [Thunkable](https://x.thunkable.com/copy/b0ccc93e07b44919274ca864a64d6ec0)

By the way, you needn’t define the counter for the loop. Thunkable will do that automatically when you use the loop block.  
Perhaps that could solve your problem.

---

<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:** [August 22, 2019, 12:06pm UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/13 "2019-08-22T12:06:12Z")

</div>

Hi, you can see an example of work on the screen scrAirTable. Hope it helps.

[https://x.thunkable.com/projects/5d370bd8814895afb4300c50/project/properties/designer/](https://x.thunkable.com/projects/5d370bd8814895afb4300c50/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)\
**Post date:** [August 22, 2019, 6:59pm UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/15 "2019-08-22T18:59:43Z")

</div>

![21%20AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/8/58c5793ef4f40ef24c15b5972a1a8a228820127f.png)

So, I think there are a few things going on with the referenced blocks. The first, as @renren66 mentions, is the use of separate variables within the loop rather than the ones that the loop provides by default. The second is the explicit `change` change blocks to increment the variables. The loop block will do that for you automatically.

The last is a bit more complicated. Fortunately I wrote something up on this previously, so please take a look at [Asynchronous Blocks within Loops](http://community.thunkable.com/t/asynchronous-blocks-within-loops/33524). It refers to the `Realtime DB` component rather than the `Spreadsheet` component but the concept is the same.

Hope this helps.

-Mark

---

<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, 12:11pm UTC](https://community.thunkable.com/t/loops-and-variables-and-spreadsheet-blocks/186836/16 "2024-11-08T12:11:49Z")

</div>


