# Providing domId for use in EmbeddedView

**URL:** <https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307>\
**Category:** Automated Testing\
**Tags:** perspective\
**Created:** [November 1, 2023, 7:42am UTC](https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307 "2023-11-01T07:42:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakned](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@jakned](https://forum.inductiveautomation.com/u/jakned)\
**Post date:** [November 1, 2023, 7:42am UTC](https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307/1 "2023-11-01T07:42:20Z")

</div>

I made a screenshot from ICC recording stating this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/efa46c577fc7a8897896aa5cde8ba5a6fb2ca31a.jpeg)

I guess this applies to situation where I embed a view. Just one.

What if I want to use a flex repeater and embed the same view n times. Does anyone have a advice how to identify those views in a repeater?

Thank you  
Jakub

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 1, 2023, 2:56pm UTC](https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307/2 "2023-11-01T14:56:03Z")

</div>

In instances where you're using a View in an embedded manner, and you have components which will need to build their ID based off of some unknown unique value, you'll want to supply a unique value to the Embedded View (or instanced View) as a param, and then bind the `domId` value against that supplied param.

For Flex Repeaters, I usually just rely on the automatic `index` param passed in by the Flex Repeater, and bind against `{view.params.index} + "_my_component"`. This will result in each instance within the Flex Repeater as having `id` attributes in the DOM of `0_my_component`, `1_my_component`, `2_my_component`, etc.

You should use the same approach outside of a Flex Repeater, though you should target whichever named param you are passing in. Make sure to provide this param at the View level and provide a default value which _does not make sense_ so that you know when it's being used appropriately.

**For example:**  
I place a new param at the View level named `my_param`. I set the value of this param to "XXXX". Thus, when used by my component as part of the `domId` binding, I'll see a value of `XXXX_my_component`. This is obviously not a value I would expect and if I see this in use I've done something wrong. Now, when I use this same View in an embedded capacity I should make sure the embedded usage receives a param of `my_param`. If I supply the param value as "YES", I should expect the `domId` to resolve as "YES\_my\_component", and therefore I should expect an HTML `id` attribute of the same.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 2, 2023, 9:14am UTC](https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307/3 "2023-11-02T09:14:13Z")

</div>

> [@cmallonee](#):
>
> the automatic `index` param passed in by the Flex Repeater

Didn't know this was a thing. Makes a few things simpler.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 2, 2023, 2:01pm UTC](https://forum.inductiveautomation.com/t/providing-domid-for-use-in-embeddedview/81307/4 "2023-11-02T14:01:36Z")

</div>

We call it out in [the docs](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Flex+Repeater#:~:text=The%20object%C2%A0will%20usually%20contain%20one%20or%20more%20parameters%2C%20including%20the%20instance%27s%20own%20index%2C%20that%20will%20be%20passed%20into%20that%20particular%20instance.%20As%20a%20side%20note%2C%20overwriting%20the%20index%20parameter%20is%20not%20recommended.), but it's sort of a weird automatic property that makes it hard to define where it should go in the documentation.
