# Strange Behaviour Of List Indices

**URL:** <https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908>\
**Category:** Questions about Thunkable X\
**Created:** [January 23, 2019, 9:38pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908 "2019-01-23T21:38:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuspiciousLukingPlnt](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SuspiciousLukingPlnt](https://community.thunkable.com/u/SuspiciousLukingPlnt)\
**Post date:** [January 23, 2019, 9:38pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/1 "2019-01-23T21:38:18Z")

</div>

Hi,  
in the app I’m making the indices of my lists are acting weirdly. If I am looking at the screen open on the live testing then all of my lists in the code for that screen work properly on the live testing with no issues. But if I am looking at a different screen then the lists act like they start at 0 instead of 1 and this messes up the live testing of my app.

Has anyone else encountered this issue? Any suggestions for fixes or workarounds are welcome.

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [January 24, 2019, 9:46am UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/2 "2019-01-24T09:46:35Z")

</div>

Hi @SuspiciousLukingPlnt, yes I have similar problems in ThunkX with lists:

- in an App with multiple screens there seems to be a difference in iterating through a list when another screen is opened in blocks or not
- iterating with a double loop does not work correctly (I played around with a bubble sort algorithm, which uses two nested loops)

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [January 25, 2019, 5:07pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/3 "2019-01-25T17:07:22Z")

</div>

Hi @SuspiciousLukingPlnt and @Michael_Rogulla could you share a project, either here or via a PM, that demonstrates this issue? thanks

---

<div class="post-metadata">

**Author:** ![SuspiciousLukingPlnt](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@SuspiciousLukingPlnt](https://community.thunkable.com/u/SuspiciousLukingPlnt)\
**Post date:** [January 25, 2019, 7:43pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/4 "2019-01-25T19:43:05Z")

</div>

Hi @domhnallohanlon

I found a workaround and have already implemented it. It would take some back tracking to get that problem. If I run into the problem again I’ll make sure to send it to you.

If its of any use to anyone, my workaround is this:

 ![ScreenCapOfIndexesProblem](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/7/776e72a171be6ffc2f4814e586463e184d4b53bc.png)

In my database I make the first item in the list ‘¬’, I then have my code see if that’s in the first position. If it is I have the 1st item I want as the 2nd index, and so on.  
If it can’t see it, it means that the indices have messed up and skipped it so I have my code just take the 1st item I want from the 1st index, and so on.

That’s been working for me so far

---

<div class="post-metadata">

**Author:** ![rcd3](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@rcd3](https://community.thunkable.com/u/rcd3)\
**Post date:** [January 27, 2019, 6:59pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/5 "2019-01-27T18:59:31Z")

</div>

Hi @domhnallohanlon,

As pointed out by @SuspiciousLukingPlnt and @Michael_Rogulla, there appears to be a bug in the “in list get #” block when used in combination with a list viewer. I’ve created a simple app to demo the bug at [https://x.thunkable.com/copy/aeb9a9da63b58cffe82a2b4a9464fde5](https://x.thunkable.com/copy/aeb9a9da63b58cffe82a2b4a9464fde5)

Instructions to reproduce the bug:

1. Make a copy of the demo app.
2. Open Screen2 in the block view.
3. Live test the app. Notice that whichever list item you select on Screen1, the corresponding list item is displayed on Screen2.
4. Open Screen1 in the block view.
5. Live test the app. Notice that whichever list item you select on Screen1, the incorrect list item is displayed on Screen2 (shifted by index + 1).

I haven’t found a good workaround for this bug – other than keeping the correct screen open in the block view. Any advice is greatly appreciated.

Cheers,

Guido

---

<div class="post-metadata">

**Author:** ![Michael\_Rogulla](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@Michael\_Rogulla](https://community.thunkable.com/u/Michael_Rogulla)\
**Post date:** [January 27, 2019, 10:51pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/6 "2019-01-27T22:51:32Z")

</div>

Hi all (@rcd3, @SuspiciousLukingPlnt, @domhnallohanlon), today I found that I cannot trust the “count with” - block with lists:

- create a “count with” block like:  
– count with i from “1” to “length of list” by “1”  
– do … in list get #i …

… will not work correctly. In my case the first item will be forgotten! I have to explicitly take the number-block from “Math”, insert it in the slots in the “count with” - block and fill in the number “1”, even if it is filled with a “1” by default.

---

<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:16pm UTC](https://community.thunkable.com/t/strange-behaviour-of-list-indices/65908/7 "2024-11-08T12:16:26Z")

</div>


