system.gui.getParentWindow(event) in perspecive

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

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.

3 Likes

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

2 Likes

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

1 Like

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

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 scripts in Perspective, and you'll want to bind the Dropdown with a Named Query binding.

1 Like

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.

1 Like

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 scripts in Perspective, and you’ll want to bind the Dropdown with a Named Query binding." …
plz elaborate…

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).

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")
1 Like

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 :+1:Thanks for your reply