# How can I use the switch component to dynamically display different data

**URL:** <https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597>\
**Category:** Questions about Thunkable X\
**Created:** [March 26, 2022, 4:26pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597 "2022-03-26T16:26:29Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 26, 2022, 4:26pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/1 "2022-03-26T16:26:30Z")

</div>

@tatiang, @muneer:  
Hello everyone:  
I am making an app that involves using 3 text to speak. Everything was working fine.

 ![label0](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/78736dc767a440833a2a7cad760e021afd01e949.png)

But I decided to incorporate three switches so that the user could choose at any given time. Yesterday it worked fantastically: when pronouncing each word, it changed its color and size…

 ![label1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/5/b5de5d31bb91da1d4834f70edb486c45e5293a87.png)  
 ![label2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/9/99c0e5dfda124730c07c8c1ad99aae0815e8137c.png)

but today what it does is that it leaves the page blank, and of course it doesn’t speakanything…

 ![label3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/8/380906c948106d24d57cf5cc1f3290a440c57817.png)  
I’ve tried using and without using what is shown here in the blocks of the three languages, but it shows no difference  
 ![Blocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/b/7bad4d1b996f3685e5d8095af2df6b25ddc402a1.png)

Is this because of my poor programming, or is it something else?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 26, 2022, 5:03pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/2 "2022-03-26T17:03:57Z")

</div>

Either this condition is structured **wrong** or I could get what you’re up to.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/4/241ac01ddf2370c7fdd22d27d0159e6cdee6865c.png)

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 26, 2022, 6:09pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/3 "2022-03-26T18:09:11Z")

</div>

@muneer  
Hi, I took this example of yours

 ![Muneer switches example](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/5/654a99a1a3df3e2acce4312a3b9a3f004dc9bc13.png)

but you know I don´t know much. Anyway, how could it work yesterday and not today? I use to press Ctrl + F5… could you help me?  
Thanks

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 26, 2022, 6:12pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/4 "2022-03-26T18:12:46Z")

</div>

From the condition that you shared, you will see no labels and here no sounds unless you set the **3** switches to **OFF** which is a weird condition to check for.

---

<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:** [March 26, 2022, 6:37pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/5 "2022-03-26T18:37:25Z")

</div>

It’s hard to help you when you create separate topics for the same issue. It’s better to update your existing topic so that all of the prior knowledge and suggestions are visible.

But… it seems that you should have a separate IF condition for each switch value rather than combining them into one condition.

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 26, 2022, 6:44pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/6 "2022-03-26T18:44:53Z")

</div>

Well, yesterday I was talking about the same switches, but using them in a DVL… and it’s working fine… by now

 ![DVL switches](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/7/c760af80c2d3dbd8352f0eedb6e633133dbd9d79.png)

 ![expressions dvl switches](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/4613f5295fda7d8f4c9ff4c8e0350b59614a82c7.png)

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 26, 2022, 6:50pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/7 "2022-03-26T18:50:10Z")

</div>

And now we have labels again, but no sound… just a little better, but useless… I can´t understand it

 ![label5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/2/828d90c6aaedca8c062a2713b8f6ab6b0dab3002.png)

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 26, 2022, 6:52pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/8 "2022-03-26T18:52:46Z")

</div>

> [@tatiang](#):
>
> But… it seems that you should have a separate IF condition for each switch value rather than combining them into one condition.

How do I do it so that it works fine?

---

<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:** [March 27, 2022, 1:48am UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/9 "2022-03-27T01:48:32Z")

</div>

The way you have it in your screenshot above:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/5/758a1592be17b7d6a1c74405b9edef14ada3a291.png)

Or this:

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

It’s not clear to me why it’s not working and how you’ve tested/verified that (e.g. with debugging labels to make sure sections of code are actually running). Do the SpeakUK, etc. functions run at all? Do they start and not speak anything? Do they not start? Are they skipped?

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 30, 2022, 9:55am UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/10 "2022-03-30T09:55:34Z")

</div>

@ tatiang, @muneer:  
hi,  
When I execute with live test, the background color of the flags changes, according to the expected succession… but the colors of the different labels (English, British Transc., American Transc. and Spanish) do not change, nor does it sound any sound. Neither when I click on the DVL, only the backgrounds of the flags change

---

<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:** [March 30, 2022, 1:42pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/11 "2022-03-30T13:42:06Z")

</div>

The problem is that you’re explaining it in a very general way, that no sound plays when you test the project.

What I’m suggesting is that you need to find ways to show on screen that a particular set of blocks has run. To make sure your If conditions are working properly.

I suggest a way to do that here:

> [@Debugging in Thunkable X (Video)](https://community.thunkable.com/t/debugging-in-thunkable-x-video/849471):
>
> I thought I’d share a process I use for debugging my projects. It involves creating a function that can be used over and over throughout the code blocks in order to help determine where things are going wrong, whether or not certain blocks are ever triggering, and what the values of several variables are. Here’s a screenshot of what I’ve set up: The real power comes from being able to quickly change the delay (and even set it to 0 seconds) or just remo…

---

<div class="post-metadata">

**Author:** ![similar2similar](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@similar2similar](https://community.thunkable.com/u/similar2similar)\
**Post date:** [March 30, 2022, 10:15pm UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/12 "2022-03-30T22:15:37Z")

</div>

@tatiang , @muneer  
Thanks for the advice and the video. It is very interesting… In my case, I know exactly what doesn’t work, because it doesn’t run on the screen page when I try a live test : nothing inside the DVL works. And what is outside, works. But I don’t know why.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [March 31, 2022, 2:20am UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/13 "2022-03-31T02:20:51Z")

</div>

Have you followed @tatiang suggestion of using debug labels?

If you have you’d by now seen which block or group of blocks that does not get executed.

---

<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:** [June 29, 2022, 2:21am UTC](https://community.thunkable.com/t/how-can-i-use-the-switch-component-to-dynamically-display-different-data/1803597/14 "2022-06-29T02:21:42Z")

</div>

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