# Check view is available or not on perspective

**URL:** <https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 4, 2024, 9:42am UTC](https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793 "2024-07-04T09:42:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sabhareeswaran\_Ravi](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Sabhareeswaran\_Ravi](https://forum.inductiveautomation.com/u/Sabhareeswaran_Ravi)\
**Post date:** [July 4, 2024, 9:42am UTC](https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793/1 "2024-07-04T09:42:44Z")

</div>

How can I check if a view is available using expressions or scripts? For instance, if I pass dynamic view names to an embedded view, I want to validate if the view exists in the project views. Rather than allowing Ignition to throw a "view not found" error, I would like to handle this scenario with a custom message.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 4, 2024, 2:05pm UTC](https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793/2 "2024-07-04T14:05:02Z")

</div>

This is the function I use:

```python
def exists(viewPath):
	for view in system.perspective.getProjectInfo().views:	
		if view['path'].lower() == viewPath.lower():
			return True	
	return False

```

---

<div class="post-metadata">

**Author:** ![Sabhareeswaran\_Ravi](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@Sabhareeswaran\_Ravi](https://forum.inductiveautomation.com/u/Sabhareeswaran_Ravi)\
**Post date:** [July 5, 2024, 7:28am UTC](https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793/3 "2024-07-05T07:28:05Z")

</div>

Thanks, Nick 😄

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 5, 2024, 4:57pm UTC](https://forum.inductiveautomation.com/t/check-view-is-available-or-not-on-perspective/92793/4 "2024-07-05T16:57:51Z")

</div>

Minor golf:

```python
def exists(viewPath):
	needle = viewPath.lower()
	return any(view['path'].lower() == needle for view in system.perspective.getProjectInfo().views)

```

Lowering the search string only once is also a micro-optimization 😄
