# \[Feature-1739\]Perspective Relative Path for Embedded View, Flex Repeater, etc

**URL:** <https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 2, 2021, 10:20pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918 "2021-02-02T22:20:23Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![joyja](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joyja/32/9401_2.png) [@joyja](https://forum.inductiveautomation.com/u/joyja)\
**Post date:** [February 2, 2021, 10:20pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/1 "2021-02-02T22:20:23Z")

</div>

It would be nice to be able to optionally reference other views via a relative path in the path prop. For example, in this image if we could reference ‘./Realistic’ instead of ‘Components/Pump/Symbol/Realistic’ I could then rename the folder or move everything to a different folder without breaking the references.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/732af70fc272791ae7f6885a64aeec681a067f81.png)

---

<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:** [February 3, 2021, 12:12am UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/2 "2021-02-03T00:12:57Z")

</div>

Hacky workaround:

Bind the `path` property with a property binding on any property (you actually need access to the transform part of the binding).  
Add a transform to the binding.  
Supply the following script: `return "/".join(self.view.id.split("/")[:-1]) + "/desiredViewName"` where “desiredViewName” is the name of the View you want a relative position of.

In this example, I bound against `view.props.loading.mode`, but I don’t need that value - I just need the transform. Note the returned value in the binding dialog preview area.

 ![Screen Shot 2021-02-02 at 4.11.33PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/0569deef883dae42b3beed24c4b5817014b57745.png)

With that binding in place, I was able to drag my `something` directory around into different locations of my View directories and the references to other Views within the directory remained functional.

---

<div class="post-metadata">

**Author:** ![joyja](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joyja/32/9401_2.png) [@joyja](https://forum.inductiveautomation.com/u/joyja)\
**Post date:** [February 3, 2021, 12:45am UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/3 "2021-02-03T00:45:32Z")

</div>

Perfect! I was attempting to implement a workaround like this and that self.view.id property is what I was looking for. That will get me going for now. Thanks!

---

<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:** [March 31, 2021, 1:45pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/4 "2021-03-31T13:45:11Z")

</div>

I’ll suggest `self.view.id[:self.view.id.rfind('/')]`, which avoids spliting and joining.  
It might be less readable when dealing with this kind of variable, but this can easily be fixed by assigning the string to another var, which actually makes the whole thing more readable than the initial solution in my opinion:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/2/027df412e2d1edfa5f7bc8221b6e816b79aaa4cb.png)

Is this actually a bad solution ?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 2, 2024, 8:13am UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/5 "2024-05-02T08:13:32Z")

</div>

@pturmel, can the Integration Toolkit be used to execute this Python script?

```python
 "/".join(self.view.id.split("/")[:-1]) + "/desiredViewName"

```

---

<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:** [May 2, 2024, 8:46am UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/6 "2024-05-02T08:46:44Z")

</div>

`where` is not a python keyword, and no amount of integration toolkit will change that.

What are you trying to do ?

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 2, 2024, 12:07pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/7 "2024-05-02T12:07:00Z")

</div>

I mean the .join.  
The where was the comment which I mistakenly copy from original post.

---

<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:** [May 2, 2024, 12:19pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/8 "2024-05-02T12:19:14Z")

</div>

So what you want is the expression equivalent of this python code ?

---

<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:** [May 2, 2024, 12:20pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/9 "2024-05-02T12:20:01Z")

</div>

Sure, with `objectScript`. But for best performance, I'd make a pure expression with `groupConcat()`, `where()` and `split()`.

```python
groupConcat(
	transform(
		forEach(
			split({view.id}, '/'),
			it()[0]
		),
		asPairs(
			where(
				value(),
				idx() < (len(value())-1)
			),
			asList(
				'desiredViewName'
			)
		)
	),
	'/'
)

```

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [May 2, 2024, 7:55pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/10 "2024-05-02T19:55:06Z")

</div>

That's what I meant. Perfect. Thanks, Phil. Of course, the only reason I ask for this is the performance.

---

<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:** [May 2, 2024, 7:59pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/11 "2024-05-02T19:59:13Z")

</div>

I just realized this is probably faster:

```python
groupConcat(
	transform(
		split({view.id} + "/desiredViewName", '/'),
		where(
			value(),
			idx() != (len(value())-2)
		)
	),
	0,
	'/'
)

```

---

<div class="post-metadata">

**Author:** ![Kevin\_Verschueren](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@Kevin\_Verschueren](https://forum.inductiveautomation.com/u/Kevin_Verschueren)\
**Post date:** [June 27, 2024, 2:44pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/12 "2024-06-27T14:44:00Z")

</div>

Hi guys,

Nice solution for the reference. Is there also a way to make this kind of binding default on the embedded view?  
For example If i use the embedded view 10 times in my view, i always have to make this binding manually. It's ok for myself but for others who may not know this is required, they may forget to do this and then then you have a mix of relative bindings and direct bindings to the embedded view which can result in unwanted result if you think you can freely move the view.

Better should be that this relative binding can be set as default on the path.

---

<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:** [June 27, 2024, 2:56pm UTC](https://forum.inductiveautomation.com/t/feature-1739-perspective-relative-path-for-embedded-view-flex-repeater-etc/42918/13 "2024-06-27T14:56:11Z")

</div>

There are no default bindings anywhere in Ignition. You **can** copy and paste them. Also, duplicating a component duplicates its bindings.
