Binding text of one window to another window

Hi,

Been playing with ignition for a bit and going to training soon, but have a question. I would like to make an “active” sidebar in my project in which when you click the text of a label in my north docked navigation pane, it changes a value or text in a label or navigation tree in my west side docked window. I am finding it hard to transfer data between windows/root containers.

Any help would be appreciated! Thank You!

You could use a client tag to achieve this. Create a Client Tag that is a string data type. Place a mouseReleased event on the label with

         system.tag.write("[Client] tagname", "string value")

in the script editor. Now bind the other label in your docked window, or whichever component your using, to the client tag.

I m also facing the same issue. plz help

how to bind text prop from one window into another window?(Perspective)

in perspective you can use a custom session property.
or message handlers.

dont use tags for this in perspective as there are no “client tags”

3 Likes

Thanks for your reply!


in custom session property, it is only showing session props and I want to bind the text value from window so how it is possible. Please help.

you will have to bind the window prop to the session prop not the other way around. As the session doesnt know anything about any windows

The answer really is that you can’t bind component properties on one Window/View to another Window/View as they don’t know each other exists, especially not in development time. You need to use something that is always present and known, which is where client tags (Vision) and session custom props or message handlers (Perspective) come in. You bind your components to these (or for message handlers, you don’t bind but you implement them) to pass values around.

I would avoid using tags wherever possible with perspective with things like this since tags are gateway scoped and will update for input from any perspective client. This makes an application with multiple clients an actual nightmare that you won’t notice in dev since you are the only one making changes.

I agree with nminchin above that session properties and messages are the way to go. I tend to almost exclusively use message handlers for this thought since I like to reserve session properties for “higher-level” project scoped properties and not just individual view properties.

One caution with message handlers though is that they can sometimes be difficult to trace, especially with Ignitions limited debugging tools. I usually like to wrap all of my message handler scripts with the following code so that debugging is easier, especially in larger projects:

import sys

try:
	#message handler code here
except:
	system.perspective.print('Handler Name')
	system.perspective.print(str(sys.exc_info()))

1 Like

Thanks for the replies.
I want to pass the text value from one view to another popup view event scripting.
below is my view1 text component

and I want to pass the text value to below view 2 button event so that it saves aftr clicking on save button and data gets saved.

plz help me on this

yeah you should not use session props for this.

You can add props to a popup.
using view params

In the popup view you can add a param here:


Then you can link it here:
image
Or if you use script somehting like this:
system.perspective.openPopup("myPopupId", "folder/custompopup", params={"aParam":self.props.text})

2 Likes

thank u so much for your help. I will try this out

1 Like

as you said i have added params via scripting on main View’s save button, plz check below img

now on this below popup view button, parameters are not showing so how can i use those values and pass it to the database?

there is no params under popup view’s button event to store/pass into database

I am new to this plz help me in solving this

If you place them here inside the popupview they should show up in the "explorer" thingy in your popup. You probably will have to close and reopen the config though so it can update the "explorer"

1 Like

Thanks again for your reply!
I want to pass the values from scripting to popup params as I have converted some component values and called required other popup msgs to display and validations too so after going through all these things data needs to get saved after clicking on yes,proceed button (which popups after clicking on main view’s save button). so how can I pass values from save button event scripting to yes,proceed (Popup view’s)button event script so that i can pass these values to database by calling Stored procedure on yes,proceed (Popup view’s)button
Hope you understand my concern.
need help plz
If any additional explanation required, plz let me know

I understand, what you want and i think my answers have covered everything. What else is not working?
Your popup script seems to add in the params correctly. (as far i can see on the small screenshot)
If you have added the same names (LotId, MatlName ...) to the view params of your popup:

they should show up in the browser properties
image

so you can use them just like you did in this script

1 Like

Thank u so much for the detailed explanation. I have already added the params to popup view and tried to print to check the passed value of LotId as you can check image in the above popup view event script i have added params from browser props only but while sending here i have deleted becoz in console it’s printed as “value” which is default one and not passed value of lotid so thought i am going in a wrong way.
I will try once again and confirm
Thanks a lot

if you still have problems show me the full script of where you open the popup^^

1 Like

Thank for your help !
i am getting below error
image

plz copy the script and not a screen shot and use preformated text:
image
both the script that opens the popup and the one that writes to the db

1 Like

this is the code of Popup view button script and I am not facing any error on save button, here how to convert those values to int while passing it to SP, should i share save button(main view)script (it’s too long )