# How to access prespective components within an embedded view from script

**URL:** <https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784>\
**Category:** Ignition\
**Tags:** ignition80, perspective, scripting\
**Created:** [November 18, 2020, 10:40pm UTC](https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784 "2020-11-18T22:40:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yorlov](https://avatars.discourse-cdn.com/v4/letter/y/eb9ed0/32.png) [@yorlov](https://forum.inductiveautomation.com/u/yorlov)\
**Post date:** [November 18, 2020, 10:40pm UTC](https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784/1 "2020-11-18T22:40:32Z")

</div>

Hi,  
I have a **view A** with EmbeddedView component with another **view B**. F.P, CYANIDE and SULFIDE are embedded views.

View B has two fields: checkbox and Number Field.

I want to know:

1. How to get values from this embedded view, when saving the form.
2. How to pupulate this embedded view’s field when form is opened for edit. This is initiated by:  
`system.perspective.navigate(view=viewA, params=params)`

Multiple clients might be working with this form simultaneously. Multiple forms A can be openned to edit different instances.

Any help will be appreciated!  
Thanks!

---

<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 19, 2020, 12:33am UTC](https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784/2 "2020-11-19T00:33:35Z")

</div>

There are several different ways to get values from within en Embedded View. The two following methods are the most common, useful, and easy to maintain:

**1. Using View params:**

- The View itself needs to have params in place. In the Project Browser, click the View node of the View which you will be embedding (View B).

- Locate the params category and make a new param value (or an object which contains relevant param values) and click the arrows to the right of the value until the arrows point both ways (bidirectional).

- 

- Bind the components with values you need to access to the relevant param values, and make sure the bindings are also bidirectional.

- In View A, specify viewParams which match the keys you specified in View B.

- ![Screen Shot 2020-11-18 at 4.22.56PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/0455227a1aff06719acd7a3a8a0903dcc2c3bbb0.png)

Now, you can bind against `EmbeddedView.props.viewParams.value_bool` to obtain the value of the checkbox in the embedded view.

**2. Messaging**

- In View B, select the checkbox, and right click `Checkbox.props.selected`.
- Select “Add Change Script”.
- Supply the following code:

```auto
system.perspective.sendMessage('CHECKBOXCHANGE', payload={'value': currentValue.value}, scope='page')

```

- In View A, on the Embedded View component itself, set up a custom property named `value_bool`.
- Now right-click the Embedded View component and select “Configure Scripts”.
- Double-click “Add Handler”.
- Supply “CHECKBOXCHANGE” for the Handler name.
- Make sure the scope checkbox for “page” is selected.
- Supply the following script here:

```auto
self.custom.value_bool = payload['value']

```

Repeat these steps for the Numeric Entry Field.

---

<div class="post-metadata">

**Author:** ![yorlov](https://avatars.discourse-cdn.com/v4/letter/y/eb9ed0/32.png) [@yorlov](https://forum.inductiveautomation.com/u/yorlov)\
**Post date:** [November 19, 2020, 3:51pm UTC](https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784/3 "2020-11-19T15:51:51Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![manjuyadav95.m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@manjuyadav95.m](https://forum.inductiveautomation.com/u/manjuyadav95.m)\
**Post date:** [November 19, 2021, 9:09am UTC](https://forum.inductiveautomation.com/t/how-to-access-prespective-components-within-an-embedded-view-from-script/40784/4 "2021-11-19T09:09:05Z")

</div>

Hi,  
If I want checkbox as a view in the table column then how can I achieve this bcoz if render: boolean and boolean prop: checkbox are selected then need to click 2times to select the checkbox in the table column …is there any solution for this ?If I select render as view and viewpath of checkbox(created in separate view) then it is not returning any value by clicking on checkbox column…  
on render boolean…oneditcellcommit …it is returning value as true/false based on select/deselect but the issue is one click to enable the edit cell then it is allowing to select/deselect the checkbox …which is not acceptable…  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/0/2092e299e2a7de23dff9bd32ec6c7e8944e3ef26.png)
