# system.gui.getParentWindow(event) in perspecive

**URL:** <https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558>\
**Category:** Ignition\
**Created:** [February 25, 2022, 10:25am UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558 "2022-02-25T10:25:14Z")\
**Posts on this page:** 10\
**Page:** 1

<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:** [February 25, 2022, 10:25am UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/1 "2022-02-25T10:25:14Z")

</div>

this `system.gui.getParentWindow(event)` return window’sname right?  
I want to achieve this in perspective…Plz help

---

<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:** [February 25, 2022, 12:52pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/2 "2022-02-25T12:52:10Z")

</div>

Doesn’t exist. Views in Perspective have self-contained object models. Traffic outside the view must be through parameters and messages, not any object model.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 25, 2022, 1:31pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/3 "2022-02-25T13:31:49Z")

</div>

The entirety of `system.gui` is only available in the Vision context.

---

<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 25, 2022, 4:57pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/4 "2022-02-25T16:57:24Z")

</div>

Perspective pages don’t have names, so I’m not sure what you’re trying to obtain. You do have access to a pages `id`, `path` (Perspective project URL), and `primaryView` (path of primary view resource). Would any of those help you? You also have access to the `title`, but that’s just the text of he browser tab.  
 ![Screen Shot 2022-02-25 at 8.56.49 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32749b1a7b716c6bd7fa56ffbc7fa6141b653ff0.png)

---

<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:** [February 26, 2022, 5:21am UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/5 "2022-02-26T05:21:53Z")

</div>

Thanks for your reply. Actually, on-screen it should display the last dropdown selection whenever I open it.is there any way to achieve this in perspective?..  
by using getParentWindow(event), the window name gets returned and a function was created to save that window name along with the new dropdown value(by passing as args event.newValue) and dropdown name (direct dropdown name passed in string as args )in database and then another function called for dropdown auto select the last value whenever the screen gets opened by passing args window name and dropdown name (hardcoded)

and some SQL queries used with condition to store to insert and update this dropdown value in below functn and in second autoselect function select dropdown query used  
dropDownSelectionUpdate(str(system.gui.getParentWindow(event)),event.newValue,‘SavedReports’)…onpropertyChange of that dropdown component=selectedLabel  
dropDownAutoSelect(str(system.gui.getParentWindow(event)),‘SavedReports’)…on propertyChange of that dropdown component=data

I don’t know how to do it in Perspective to insert and update dropdown selection and get the last dropdown selection …plz help if you could

---

<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 26, 2022, 3:59pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/6 "2022-02-26T15:59:43Z")

</div>

> [@manjuyadav95.m](#):
>
> it should display the last dropdown selection

What "last dropdown selection"? It sounds like you're trying to save state for a Page. You should be able to do something similar by using the dropdown name and the View path in conjunction with the user's info. You should look into using [onChange](https://docs.inductiveautomation.com/display/DOC81/Perspective+Property+Change+Scripts) scripts in Perspective, and you'll want to bind the Dropdown with a Named Query binding.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 26, 2022, 5:55pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/7 "2022-02-26T17:55:36Z")

</div>

Please post a screengrab of what you are trying to do.  
Please also use the `</>` code formatting button when posting code. It will preserve indents and it will apply syntax highlighting - both of which will make it much clearer. There is an edit button (pencil icon) which allows you to fix your earlier post.

---

<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:** [February 28, 2022, 8:02am UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/8 "2022-02-28T08:02:29Z")

</div>

Last dropdown selection means…consider if I have selected “employee” from dropdown from my user credentials then next time when I open that screen then the dropdown value should be “employee” only not anything else or blank …and what I am supposed to do as I didn’t understand ur suggestion on this " You should be able to do something similar by using the dropdown name and the View path in conjunction with the user’s info. You should look into using [onChange](https://docs.inductiveautomation.com/display/DOC81/Perspective+Property+Change+Scripts) scripts in Perspective, and you’ll want to bind the Dropdown with a Named Query binding." …  
plz elaborate…

---

<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 28, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/9 "2022-02-28T15:51:38Z")

</div>

Before I start, let me say that saving state in Perspective from a user’s session to their next is going to be very difficult. I assume you’re using some sort of database to store this information, correct? Something like this (potentially incorrect syntax - I haven’t run this code).

```auto
query = "update some_table set dropdown_value=? where view_path=? and username=?"
system.db.runPrepUpdate(query, [currentValue.value, self.page.props.viewPath, self.session.auth.user.username], "DBNAME")

```

---

<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:** [March 1, 2022, 7:45am UTC](https://forum.inductiveautomation.com/t/system-gui-getparentwindow-event-in-perspecive/56558/10 "2022-03-01T07:45:15Z")

</div>

yes, in that query I need to pass view name (in vision, able to pass window name by using `system.gui.getParentWindow(event)`when dropdown gets fired …will I get view name using this `self.page.props.viewPath` ? will try this one and confirm 👍Thanks for your reply
