# How to show selected list items in separate list?

**URL:** <https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243>\
**Category:** Questions about Thunkable X\
**Created:** [January 20, 2020, 6:21pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243 "2020-01-20T18:21:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 20, 2020, 6:21pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/1 "2020-01-20T18:21:49Z")

</div>

Hi all,

I’m trying to develop an app similar to that of a shopping list, except the user chooses from existing items (restaurant menu items). This data is up on the airtable and that is working fine. The problem I’m having is in showing the selected items in a list. Here is an image of how I want it to be set up:

 ![Annotation 2020-01-20 180623](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/7/a7a0d1cbbdaf2abc27986780d08e18a51447f300.png)

My current issue is that I can get it to show one item in the list, but as soon as I click another it just erases that item and replaces it with the new selected item. Below is are my blocks for this:

 ![Annotation 2020-01-20 180638](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/6/a64e3a9a565d521f09dd4d2ffe1914626c030de5.png)

 ![ezgif.com-video-to-gif](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/8/d831e352e2a93f15972ae2051acf84c7ee0fe756.gif)

If it’s any help, following this I will want to be able to pull numeric data from these list items - the data contains the product name and the number of carbs in the item. I will then need to use some maths to calculate these carbs. Just in case this makes a difference to how I approach this?

Thanks, everybody!

Edit: The search function isn’t supposed to be doing anything just yet, that’s a problem for another time!

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://community.thunkable.com/u/Steven)\
**Post date:** [January 20, 2020, 9:10pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/2 "2020-01-20T21:10:26Z")

</div>

Hi!

You’ll need to create another list which you store (as a variable for example) and when a user selects an item you add it to that list. I think you want something like this:

 ![Screen Shot 2020-01-20 at 12.56.44 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/1/81f57c927564002a1a0ab7d3d08ed7f3fcf0f94c.png)

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 3:02pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/3 "2020-01-21T15:02:38Z")

</div>

Hi @Steven,

Thank you for this!

It appears this isn’t working either, it’s not returning any results at all now?

Is there anything else I can provide which might make it easier to narrow down?

---

<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 21, 2020, 3:40pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/4 "2020-01-21T15:40:05Z")

</div>

If you post more screenshots, someone can probably help you figure out why it isn’t working. Did you try the code @Steven posted as is (e.g. in a separate screen or project)? Did that work?

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 3:50pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/5 "2020-01-21T15:50:41Z")

</div>

Hi @tatiang, this is the code I have now tried which isn’t populating the other list at all. I’ve also included a screen recording:

 ![Annotation 2020-01-21 153205](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/9/196f84d0b0f137a039d4da841b505c3c535461bb.png)

![ezgif.com-video-to-gif (1)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/4/748ec86f4f8269d542dd68a8bb25e8863994d5a0.gif)

As you can see in the above video, the items that I click are not populating the list below at all… Ideally when I click one item it will show, then another click will show a second item below and so on if that makes sense?

---

<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 21, 2020, 4:13pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/6 "2020-01-21T16:13:58Z")

</div>

It makes sense and a screenshot and video are greatly appreciated when we’re trying to help you sort this out.

While this is a minor point and not likely the cause of the issue, you’ll want to initialize your lists to _empty list_ not _item_.

At first glance your code looks correct…

When I have a chance, I’ll replicate this and let you know what happens.

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 4:14pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/7 "2020-01-21T16:14:25Z")

</div>

Realised I hadn’t changed the variable to an empty list so I’ve now done that however the list still doesn’t populate 😕

![Annotation 2020-01-21 160355](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/2/d200ade266a681c794150e9242718feaecbec949.png)

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 4:18pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/8 "2020-01-21T16:18:55Z")

</div>

Hmm, so if the code looks correct, where do I go from here? Thank you for taking a look, I really appreciate it! If needs be let me know if you want the link to the project!

---

<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 21, 2020, 5:20pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/9 "2020-01-21T17:20:43Z")

</div>

There are other factors that can affect correct code blocks. As a somewhat extreme example, if you were running an endless loop (e.g. forever block) that was constantly changing/retrieving data within the same screen, that might be enough to take up all of the device memory allocated to Thunkable and prevent other blocks from working properly.

So taking a look at your project would be helpful as well.

But I’ll still set up a similar project to see if it works as you have it set up in your latest screenshot.

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://community.thunkable.com/u/Steven)\
**Post date:** [January 21, 2020, 5:31pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/10 "2020-01-21T17:31:07Z")

</div>

I suspect there is something else going on in the project which is preventing it from working as expected. @tatiang is correct, looking at the project is likely the easiest way to help you. If you don’t want to share it publicly you can send it to me in a private message and I’ll take a look.

As a side note, the light green blocks (`error`, `column`, `item`, & `index` in this case) are values that are being returned from the block they are attached to (`GetColumn` or `ItemClick`) which means that they will only work inside the `do` or `then do` blocks immediately below them. It is possible that this is contributing to the issue as there can be weird behavior if you try to use those blocks outside of their scope.

---

<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 21, 2020, 5:54pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/11 "2020-01-21T17:54:31Z")

</div>

So this does work for me:

[I can share the project link but without my Airtable API key and base ID, it’s not very useful to see.]

[![](https://img.youtube.com/vi/htd0ch-iYKs/maxresdefault.jpg "shopping list demo") ](https://www.youtube.com/watch?v=htd0ch-iYKs)

 ![Screen Shot 2020-01-21 at 9.40.26 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/78256b51469348a2b75fd7d11ae68f797586789a.png)

---

<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 21, 2020, 5:58pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/12 "2020-01-21T17:58:34Z")

</div>

You’re using app selectedList as the columnName input for your spreadsheet but it doesn’t look like you’re giving it a value (besides the invalid _item_ block). Try setting the columnName to a text string, as I’ve done in my example.

I’m actually surprised you’re able to pull any data into the top list viewer using the _item_ block!

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 6:26pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/13 "2020-01-21T18:26:39Z")

</div>

Thanks for this info, weird that it isn’t working on mine! I don’t have a forever block as far as I’m aware - if you’d like to look at the project is it best to paste a link publicly here? I’m totally new to all of this as you can probably guess! The app selectedList is so that it presents data from the right airtable column - here’s the blocks from the previous screen (seen in the video) which includes the likes of McDonalds, TGI Fridays and Greggs:

 ![Annotation 2020-01-21 181529](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/d/edf4e525c506180b6aaa2adf38eae9325ce2e8ec.png)

---

<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 21, 2020, 6:30pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/14 "2020-01-21T18:30:08Z")

</div>

Okay, that makes more sense. Again, initializing a variable to “item” doesn’t do anything and should probably be avoided. But now I see where you are assigning _item_ to the _app selectedList_ variable and that looks fine.

Sharing a link publicly as a non-pro user is really up to you. It does draw attention to your project so if you’re keeping things under wraps, you might not want to. Ultimately, the project is available to the public whether or not you choose to post a link.

As @Steven said, you can always send him/us a private message with a link since we’re offering to help 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 21, 2020, 6:33pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/15 "2020-01-21T18:33:07Z")

</div>

I just noticed that you are initializing _app selectedList_ on the item select screen. I would delete that entire block and see if it fixes things. If not, then seeing your project would give me a big-picture view of how you’ve organized things.

Edit: see my response below – you may not need to delete that block after all.

---

<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 21, 2020, 6:36pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/17 "2020-01-21T18:36:17Z")

</div>

Better yet… you’re assigning an item (text string) to a list variable. What you really need is a separate variable called _app columnName_ (or similar) that stores the item on the previous screen. Then, use that variable for the column value when you call Get Column. And initialize _app selectedList_ to empty list on the item select screen.

---

<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 21, 2020, 6:52pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/18 "2020-01-21T18:52:13Z")

</div>

You have conflicting blocks:

 ![Screen Shot 2020-01-21 at 10.44.23 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/9/a9f629a74d71f79b2b4761b384bdb0720393bb09.png)

I honestly have no idea if telling the compiler to do nothing and to simultaneously do something when an item is clicked can cause problems but I’d definitely rule it out by deleting the blank blocks.

---

<div class="post-metadata">

**Author:** ![chris.bailey230698t](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@chris.bailey230698t](https://community.thunkable.com/u/chris.bailey230698t)\
**Post date:** [January 21, 2020, 7:07pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/19 "2020-01-21T19:07:02Z")

</div>

Thanks for taking a look, do you know which variables to get rid of then? It’s kind of hard for me to visualise these things - found most help through videos and images to be honest so I have some confidence in my adjustments!

Are you suggesting I change this variable to a new one ![Annotation 2020-01-21 182911](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/a/daccdea1e516dee2af1a6a5891a3037dd081dc44.png)  
and then insert that variable into the column name on the next screen?

I’ve got rid of the conflicting blocks now too - thanks for the heads up, it wasn’t the cause as the issue remains but definitely good practice for future!

---

<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 21, 2020, 7:15pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/20 "2020-01-21T19:15:28Z")

</div>

Yes! Exactly. What you’ve done isn’t technically wrong (except for initializing _app selectedList_ again on the Item\_Search\_Screen, which you should not do if you’re using it to store the item that was clicked on in the RESTAURANT\_SCREEN) but it’s confusing and it ends up being a problem when you want to use _app selectedList_ as a list later.

As an explanation, you’ve assigned a text string such as “McDonalds” to a variable that has no specific type – you initialized it as _item_ but that has no value yet on the RESTAURANT\_SCREEN – and then later you try to use it as a list when you add items to it on the Item\_Search\_Screen.

So what I’m suggesting is that you need two variables: one to hold the column value (in the screenshot above, replace set _app selectedList_ to _item_ with set _app columnName_ to _item_); and then a second variable called _app selectedList_, initialized as an empty list on the Item\_Select\_Screen – and be sure to delete all instances of it from the RESTAURANT\_SCREEN.

Programming languages typically require that you maintain a variable’s type throughout the code. So if at one point you create a variable that is an integer and then you set that value to “hello”, the compiler doesn’t know how to treat that and either returns an error or does nothing. This is in essence what you’ve done by adding a list item on the Item\_Select\_Screen to what was already created as a text string variable on the RESTAURANT\_SCREEN.

And just an aside: only initialize a particular variable once in your entire project. If you need to change it’s value, use the set variable block instead of the initialize variable block.

I’ll post revised screenshots below in a moment.

---

<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 21, 2020, 7:20pm UTC](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243/21 "2020-01-21T19:20:33Z")

</div>

RESTAURANT\_SCREEN:

 ![Screen Shot 2020-01-21 at 11.25.17 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/5/352ee6d98529661c90250e490f2b9019d4d45311.png)

Item\_Select\_Screen:

![Screen Shot 2020-01-21 at 11.14.01 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/8/38b304ca562bb020a587a69a90611f64fcb6ed3e.png)

[Next page](https://community.thunkable.com/t/how-to-show-selected-list-items-in-separate-list/418243.md?page=2)
