# Have data list load different data source based on block logic?

**URL:** <https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399>\
**Category:** Questions about Thunkable X\
**Created:** [July 7, 2021, 8:54am UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399 "2021-07-07T08:54:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [July 7, 2021, 8:54am UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/1 "2021-07-07T08:54:06Z")

</div>

@tatiang  
Hi I’m trying to on screen start have a data list load a certain data source based on the app setting.  
Example user sets the grade level difficulty either 1,2,3,4,5 or 6.  
When the screen starts I want the data list to load grade 1 data source. Currently the settings are in the side panel but trying to figure out through blocks to change this.

 ![Screen Shot 2021-07-07 at 1.47.24 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/46ec50da2a1408e713b9a65311e642e8a10ab85a.png)  
Different data sources  
 ![Screen Shot 2021-07-07 at 1.51.43 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/8/c8db30dd64a6a9ddecdb301e3c3744d36eea8317.png)  
Block logic if else statement it will check what grade level its set at then I’d have it load a data source in the data list.  
 ![Screen Shot 2021-07-07 at 1.51.59 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/c/6ce67410d8187514738cf6c60ee40938a35d23bd.png)

I asked a while back, is this possible today?

---

<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:** [July 7, 2021, 2:05pm UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/2 "2021-07-07T14:05:03Z")

</div>

Instead of using different data sources, which would require a full set of rules for each source, just separate one data source into parts for each grade level.

For example, you might have grade level 1’s data start in row 1, grade level 2’s data start in row 11, grade level 3’s data start in row 21, etc. Then use a math formula (or a list of row #s) to determine which row to use for which grade level.

Or use Firebase which doesn’t have row & column constraints. You can set up the data however you like and you never have to “switch data sources.”

Also, when you have something like set picture to word1.png or word3.png or word5.png, you can also use math and a join text block to dynamically figure out the image name based on the value of the grade level. In my example, it would be set picture to join text [“word” & app variable grade level \* 2 - 1 & “.png”]

---

<div class="post-metadata">

**Author:** ![catsarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/catsarisky/32/100661_2.png) [@catsarisky](https://community.thunkable.com/u/catsarisky)\
**Post date:** [July 7, 2021, 2:16pm UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/3 "2021-07-07T14:16:51Z")

</div>

There’s no way to use blocks to change what the data source is. You could write a bunch of logic for using a different source for each grade level (which would basically mean duplicating the parts that pull data from your datasources), but it might make more sense to have a column labeling … and Tatiang posted before I did. What he said. 🙂

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [July 12, 2021, 10:09am UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/4 "2021-07-12T10:09:50Z")

</div>

> [@tatiang](#):
>
> For example, you might have grade level 1’s data start in row 1, grade level 2’s data start in row 11, grade level 3’s data start in row 21, etc. Then use a math formula (or a list of row #s) to determine which row to use for which grade level.

I dont know how to do this. In my experience a data lists loads everything from the data source with no code, once you set it here on the right side bar. Maybe you know more?

 ![Screen Shot 2021-07-12 at 3.08.50 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/3/23e5d1ccfe7400b02d931a4c7394a240998cc62f.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:** [July 12, 2021, 1:28pm UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/5 "2021-07-12T13:28:03Z")

</div>

Sorry, I didn’t realize you were using a data viewer list (DVL) although you clearly included that as a screenshot earlier. You’re right, there’s no way to sync part of a data source to a DVL. And also no way to sync a different data source on the fly.

One way I’ve done this before is to create a DVL for each source and then hide all of the DVLs that aren’t needed. And then show each one and hide the others. But again, it’s a lot of code!

A more efficient way to do this is to use `create` or `clone` blocks to make your own DVL. Two notes about that: (1) there’s a learning curve in terms of understanding how to do that… it’s not that easy; (2) those features are only available in the older snap-to-place interface but not in the newer drag-and-drop interface.

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [July 14, 2021, 7:22am UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/6 "2021-07-14T07:22:48Z")

</div>

Thanks @tatiang I used the older snap-to-place interface.

If you know of a sample file that shows create or clone to make my own DVL I’d love to learn.

In the meantime I’ll try out the hide approach. 🙂

---

<div class="post-metadata">

**Author:** ![exploriverse.com](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/exploriverse.com/32/77609_2.png) [@exploriverse.com](https://community.thunkable.com/u/exploriverse.com)\
**Post date:** [July 14, 2021, 2:59pm UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/7 "2021-07-14T14:59:14Z")

</div>

This option worked for me “Yes!”

I put 6 DVL in the row and turned off visible in the settings panel so on start they are already invisible.  
Then have an if else statement based on the user’s grade level show the certain DVL.

Thank you! @tatiang

---

<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, 1:19pm UTC](https://community.thunkable.com/t/have-data-list-load-different-data-source-based-on-block-logic/1383399/8 "2024-11-08T13:19:52Z")

</div>


