# Path of a Component In A Container

**URL:** <https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833>\
**Category:** Ignition\
**Created:** [July 24, 2019, 3:43pm UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833 "2019-07-24T15:43:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [July 24, 2019, 3:43pm UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/1 "2019-07-24T15:43:54Z")

</div>

Hello. I recently put about 20 check boxes into a container. I am hoping to then read those check boxes to update a power table. However, I can not figure out what the path of the check box is to obtain the value. I am doing this in the script, so the code to get the attribute is quite lengthy. The att.chkBoxAtt value is the name of the check box.

```auto
system.gui.getWindow("Main Windows/DataView").rootContainer.getComponent("Container/" + att.chkBoxAtt).selected:

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2019, 3:47pm UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/2 "2019-07-24T15:47:14Z")

</div>

Use two separate `.getComponent()` calls, one for the container and one for the checkbox. `.getComponent` doesn’t take a path, just a name. Consider saving the container object in a local variable and using it for all of the checkboxes.

---

<div class="post-metadata">

**Author:** ![ammermanbrittanyf](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ammermanbrittanyf](https://forum.inductiveautomation.com/u/ammermanbrittanyf)\
**Post date:** [July 24, 2019, 3:47pm UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/3 "2019-07-24T15:47:28Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [July 25, 2019, 3:43am UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/4 "2019-07-25T03:43:18Z")

</div>

> [@ammermanbrittanyf](#):
>
> ```auto
> system.gui.getWindow("Main Windows/DataView").rootContainer.getComponent("Container/" + att.chkBoxAtt).selected:
> 
> ```

You could also do the following

```auto
system.gui.getWindow("Main Windows/DataView").getComponentForPath("Root Container.Container." + att.chkBoxAtt).selected:

```

---

<div class="post-metadata">

**Author:** ![jesusaltamirano600](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jesusaltamirano600](https://forum.inductiveautomation.com/u/jesusaltamirano600)\
**Post date:** [August 7, 2020, 12:45am UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/5 "2020-08-07T00:45:11Z")

</div>

> [@pturmel](#):
>
> Use two separate `.getComponent()` calls, one for the container and one for the checkbox. `.getComponent` doesn’t take a path, just a name. Consider saving the container object in a local variable and using it for all of the checkboxes.

Hello Pturmel. Your answer was very usefull for me. With reference to your last comment, can you explain a little bit more about saving the container object in a local variable?

Thank you very much. Regards.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [August 7, 2020, 3:48am UTC](https://forum.inductiveautomation.com/t/path-of-a-component-in-a-container/26833/6 "2020-08-07T03:48:37Z")

</div>

@pturmel is suggesting something like this so you don’t have to repeat all the code to access the container for each item:

```auto
# Get container that holds the other components.
container = system.gui.getWindow("Main Windows/DataView").rootContainer.getComponent("Container")
# Access components in container.
container.getComponent("Checkbox1").selected
container.getComponent("Checkbox2").selected
container.getComponent("Text Field").text
# etc.
```
