# \[Solved\] Reducing the number of blocks needed for multiple switches

**URL:** <https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262>\
**Category:** Questions about Thunkable X\
**Tags:** solved, switch, any-component\
**Created:** [February 19, 2020, 8:40pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262 "2020-02-19T20:40:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [February 19, 2020, 8:40pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/1 "2020-02-19T20:40:38Z")

</div>

Hi there, I’m able to use the any component block to save the data to my Realtime DB. My dilema, as you can see from my blocks, I have 75 switches in the screen alone. Right now I have individual blocks to post the swithc value when the screen oopen. How can I use the any component block to eliminate 76 duplicate blocks and crete just one? I’ve tried several time to do it but I do not get any results. Thanks.

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

---

<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:** [February 25, 2020, 5:34pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/2 "2020-02-25T17:34:46Z")

</div>

@bobbyj12 moving this out to its own topic so that it get as little more attention from the community.

Did you ask something like this recently? I feel like I build this exact example for a user back in January?

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [February 25, 2020, 7:17pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/3 "2020-02-25T19:17:50Z")

</div>

@domhnallohanlon do you have a block or two you could share please?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 25, 2020, 8:38pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/4 "2020-02-25T20:38:26Z")

</div>

Hey @bobbyj12, check this out. I think this may be what you are looking to do.

[Check this sample app, in the navigator drawer choose screen “All the Switches”](https://x.thunkable.com/copy/6c540f10370a69585b978902dd90b480)

 ![Screen Shot 2020-02-25 at 3.25.09 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/c/5c64e8db9e7027bd63703dbf5c26bb9f7035a720.png)

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 25, 2020, 8:56pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/5 "2020-02-25T20:56:38Z")

</div>

I just reread this @bobbyj12

I’ll get back on this. I can solve this, for now, think about the use of any component, find component in list of, and having that index be the index for that switches value in a stored variable with 1 position for each switch.

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [February 25, 2020, 9:02pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/6 "2020-02-25T21:02:00Z")

</div>

Thanks @jared. I will attempt it. That would really reduce the number of repetitive blocks.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 25, 2020, 9:13pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/7 "2020-02-25T21:13:16Z")

</div>

See it now

[https://x.thunkable.com/copy/48f16125f5c64f2b94adb5514cffebe5](https://x.thunkable.com/copy/48f16125f5c64f2b94adb5514cffebe5)  
my example only has 6ish switches, but you could just continue to add switches with only 1 change to the block setup.  
I think this is what you want.

 ![Screen Shot 2020-02-25 at 4.00.03 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/b/bbb339240d313c92213f420039e54701911a808c.png)

If this works for you, please post back! Happy Thunking!

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 26, 2020, 3:35pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/8 "2020-02-26T15:35:22Z")

</div>

Hey @bobbyj12, I wonder if any of those solutions worked for you??

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [February 26, 2020, 9:50pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/9 "2020-02-26T21:50:49Z")

</div>

@jared That worked great. Thanks!!!

---

<div class="post-metadata">

**Author:** ![bobbyj12](https://avatars.discourse-cdn.com/v4/letter/b/d26b3c/32.png) [@bobbyj12](https://community.thunkable.com/u/bobbyj12)\
**Post date:** [February 27, 2020, 1:23pm UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/10 "2020-02-27T13:23:16Z")

</div>

This is going to reduce the size of my app considerably. Thanks

---

<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, 11:40am UTC](https://community.thunkable.com/t/solved-reducing-the-number-of-blocks-needed-for-multiple-switches/484262/11 "2024-11-08T11:40:48Z")

</div>


