# Can anyone help me replace all of this with anycomponent blocks?

**URL:** <https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670>\
**Category:** Questions about Thunkable X\
**Created:** [January 17, 2020, 6:30am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670 "2020-01-17T06:30:35Z")\
**Posts on this page:** 14\
**Page:** 1

<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:** [January 17, 2020, 6:30am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/1 "2020-01-17T06:30:35Z")

</div>

I am creating a behavior tracking app for parents. they can choose up to 5 behaviors. there are 5 choices for data recording format for each behavior. is there a way to do this more efficiently using the anyblocks?

[edit] The screenshot of the UI is cut off, there are 5 buttons in each row and 5 total rows on that section of the ‘set up’ screen

![Screen Shot 2020-01-17 at 1.18.49 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/6/d626a681fdb13486e59054192763938d17a56bc8.png)

 ![Screen Shot 2020-01-17 at 1.15.39 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/2/d2a93949e179b026a72316826d103543e66caab4.png)

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [January 17, 2020, 9:17am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/2 "2020-01-17T09:17:49Z")

</div>

What is causing your difficulty? Take “Any button click” and implement the logic inside this block.

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/1/31af0b2953138631542e4f1ba29be9516322c14d.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:** [January 17, 2020, 12:25pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/3 "2020-01-17T12:25:15Z")

</div>

Thank you @actech r the feedback. I Was thinking that’s what I needed to use, But am not sure how to implement the logic within the blocks.

I am wondering if someone can help me to figure this part out. Or if there is a tutorial that may help me learn to do this with non-cloned rows/Buttons.

I think what I really want is to understand how to use them. I do t understand the logic of those blocks currently

(Edit) the idea with this screen is that the user makes a choice and is navigated to another screen. So whatever they pick needs to be stored in a variable to control dynamic content. Then, when this screen opens again, the buttons would need to retain the on/off color scheme.

I just found this example by @tatiang but can’t fogure how to use it for saving a value to a variable. Just for color changing a button after it is clicked. I need the buttons to retain color every time the app closes/opens based on a stored variable

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/a/fae02872bb748e02de27a3933128a88ddb846abd.jpeg)

---

<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 17, 2020, 3:39pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/4 "2020-01-17T15:39:07Z")

</div>

What you’re trying to do is complicated but I would suggest using a list or possibly two lists to store the closed/open values. The reason for a list is that the Component block returns the button ID, which is unique to each button. So if you store the ID and the closed/open value (either as a pair in a single list or in sequential order in two lists – e.g. the first element of one list is the ID of a button and the first element of the other list is the value for that button) then you can retrieve them by searching for an ID when a button is clicked and getting the value from the list for that ID.

You’d then need to save the lists to the device or to the cloud.

---

<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:** [January 17, 2020, 4:51pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/5 "2020-01-17T16:51:46Z")

</div>

That sounds like the solution, but above my skills at this time. I am okayish when working with lists, but I need to understand the logic of your first example before I can follow the text explanations. I try to follow it by reading it outloud in logic terms but i get lost… i have a lot of practice and learning to do still 🙂

---

<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:** [January 17, 2020, 6:02pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/6 "2020-01-17T18:02:09Z")

</div>

> [@jared](#):
>
> there are 5 choices for data recording format for each behavior

One quick question - just looking into a template for this - is this a case where the user can only choose one option out of the 5 choices?

---

<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:** [January 17, 2020, 6:05pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/7 "2020-01-17T18:05:46Z")

</div>

yes. when they make the choice, that choice is stored the corresponding variable “stored BX1dataformat”, “stored BX2dataformat” etc. you can only have 1 data format for that behavior at a time.

Here is a link if anyone wants to check it out! I would love FB on optimization or if you use it and like it or don’t! The DataSheet screen alone has over 1000 blocks after using functions for optimization

[https://x.thunkable.com/copy/4e80d400b2290d0ce696fb14c9a03fd9](https://x.thunkable.com/copy/4e80d400b2290d0ce696fb14c9a03fd9)

---

<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 17, 2020, 6:56pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/8 "2020-01-17T18:56:07Z")

</div>

Any Component blocks are a mind\*\*\*\*. But I’ll see if I can make a little tutorial for you soon.

---

<div class="post-metadata">

**Author:** ![Daniel\_Coglitore](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Daniel\_Coglitore](https://community.thunkable.com/u/Daniel_Coglitore)\
**Post date:** [January 17, 2020, 6:56pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/9 "2020-01-17T18:56:49Z")

</div>

The project is private I cant help you further =(

have you tried like this ?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/7/07efa9b2a7ce361772de8d0c1f60a62806de77b8.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:** [January 17, 2020, 7:57pm UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/11 "2020-01-17T19:57:32Z")

</div>

Thank you! They really are hard to understand for me. I think i am starting to get how to work with them it but i still dont understand the logic with them or how to limit the items or change things.

I can use the “on any button click” block. beyond that my brain rolls… unfortunately. i would love some good tutorials to use the anycomponent blocks. or any explanations for that matter.

---

<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 18, 2020, 12:34am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/12 "2020-01-18T00:34:44Z")

</div>

Here’s a video I just made that explains one way to use the Any Component blocks. I hope you find it useful. There’s a link to the project on the title screen of the video.

(Cross-posted to Thunkable X Tutorials)

---

<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:** [January 18, 2020, 6:33am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/13 "2020-01-18T06:33:30Z")

</div>

yes! I have been doing these as well! thank you!!

i wish i had before and after shots of the blocks. Using regular functions and function with outputs have saved me at least 400 blocks in my main app i am developing

---

<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:** [January 18, 2020, 7:24am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/14 "2020-01-18T07:24:36Z")

</div>

The best!!! Thank you!

---

<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:45am UTC](https://community.thunkable.com/t/can-anyone-help-me-replace-all-of-this-with-anycomponent-blocks/412670/15 "2024-11-08T11:45:59Z")

</div>


