# How to store the live data from a data source in a list and then display it randomly in a label?

**URL:** <https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365>\
**Category:** Questions about Thunkable X\
**Tags:** solved, beginner\
**Created:** [October 5, 2023, 11:57pm UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365 "2023-10-05T23:57:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![diogoalfsz6f](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@diogoalfsz6f](https://community.thunkable.com/u/diogoalfsz6f)\
**Post date:** [October 5, 2023, 11:57pm UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/1 "2023-10-05T23:57:05Z")

</div>

Hi guys!

I’m trying to store the current values from a data source into a list and then randomly display it. After being displayed, if the button is pressed again the row is removed from the list. I had great success using this same approach for random numbers, but when I try to use the data source I cant get the values. I have also checked and tried old posts like this, but removing the data would also impact the data source.

Here is my work right now, any help would be greatly appreciated!

 ![Thunkable](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/e/7e0036bf2749dd61e9b94a823593b52f3e72bfd3.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:** [October 6, 2023, 12:13am UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/2 "2023-10-06T00:13:31Z")

</div>

Hi and welcome to Thunkable!

What you posted looks like the right approach for getting a random data source value and then removing it from the data source. I’m not sure why that wouldn’t work. What happens if you try to get a specific item from the list? For example, “get #3” instead of “get and remove random”? Does that work?

---

<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:** [October 6, 2023, 12:23am UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/3 "2023-10-06T00:23:22Z")

</div>

Ah, okay, I think I know what’s happening here. I had to run a test of those blocks myself to figure it out. When you get and remove a random item from the `list of values` block, it does get a random value but it’s essentially attempting to remove a value from a temporary list storage. You can’t modify data source values that way. The `list of values` block holds the values from the data source but it isn’t actually the data source. Confusing?

So to do this properly requires a different approach. A simple fix is to assign the `list of values` block to an app or stored variable and then when you use the `get and remove` block on that variable, it will modify the list because it’s held in a variable.

Try this:

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

If you need to also update the data source itself (not just the copy of the data held in the variable), you’ll need a few other blocks.

---

<div class="post-metadata">

**Author:** ![diogoalfsz6f](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@diogoalfsz6f](https://community.thunkable.com/u/diogoalfsz6f)\
**Post date:** [October 6, 2023, 11:28am UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/5 "2023-10-06T11:28:26Z")

</div>

It worked perfectly 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:** [October 6, 2023, 2:38pm UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/6 "2023-10-06T14:38:43Z")

</div>

You’re welcome! You can mark my post as a solution by clicking the checkbox at the bottom.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [January 4, 2024, 2:38pm UTC](https://community.thunkable.com/t/how-to-store-the-live-data-from-a-data-source-in-a-list-and-then-display-it-randomly-in-a-label/2630365/7 "2024-01-04T14:38:52Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
