# \[SOLVED\] How to target a static component using a dynamic value to change the components properties

**URL:** <https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396>\
**Category:** Questions about Thunkable X\
**Created:** [April 17, 2024, 6:25pm UTC](https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396 "2024-04-17T18:25:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [April 17, 2024, 6:25pm UTC](https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396/1 "2024-04-17T18:25:44Z")

</div>

I have components named “label\_One”, "input\_One, “label\_Two”, “input\_Two”, “label\_Three”, “input\_Three”.

I have a list of sublists that would look like:  
[  
[One, 1],  
[Two, 2],  
[Three, 3]  
]

I want to setup a for loop that will take the first entry of my sublist “One”, “Two”, “Three” and change the properties on my components by targeting them dynamically in the for loop:

for j in List  
set (“label\_” + j.0)'s Text to “j.0”  
set(“input\_” + j.0)'s Text to “j.1”

Is this possible, can it be done?

---

<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:** [April 19, 2024, 8:18pm UTC](https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396/2 "2024-04-19T20:18:32Z")

</div>

Hello @marion.dorsett Welcome to the community  
Could you please share the blocks you have used so far?

Be sure to check out our posts about [How to ask Great Questions v2.0](https://community.thunkable.com/t/how-to-ask-great-questions-v2-0/2689983/1) and our [Community Guidelines](https://community.thunkable.com/t/community-guidelines/78/8) as you get started.

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [April 19, 2024, 8:46pm UTC](https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396/3 "2024-04-19T20:46:59Z")

</div>

Thanks for the reply, but I actually just figured it out.

The key was the Any Component block, my guess would be that I misunderstood the documentation.

I have 30 sets of 3 fields that will create a list of data:

 ![workout-editor](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/d/2d2d45b0bcd938c89c26a472954193bc8cc12ea2.png)

… and I didn’t want to have to link to each one individually, and using a loop makes the code faster, and easier to manage.

Using the Any Component block I was able to make the text string in the loop to target the component name like I wanted.

 ![workout-editor-blocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/2/b21b6c8746659e5cfee1b2800ce6aecf742cdd7d.png)

Now that I’ve figured this out, I save the data back to local storage by writing a function to extract the data from the fields, and not have to write static code for each component.

---

<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:** [July 18, 2024, 8:47pm UTC](https://community.thunkable.com/t/solved-how-to-target-a-static-component-using-a-dynamic-value-to-change-the-components-properties/2952396/4 "2024-07-18T20:47:50Z")

</div>

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