Passing custom property through different views-perspective

Hi, I have a custom property in a view with value getting from datetime input component, I want to pass this live value to the custom property on another view. I am wondering how could I do it? thanks!

It depends on the relation of the two Views.

A. View2 is Embedded View within View1, OR View2 is a Popup opened by View1:
Pass the property value as a param to the Embedded View/Popup.

B. View2 is on a different Perspective Page than View1:
Bidirectionally bind the custom property on View1 to a custom session property. Bind the custom property on View2 to the same custom session property.

C. View2 is a Docked View of the Perspective Page which contains View1:
You could still use the session property route, or you could use system.perspective.sendMessage() docs as part of a change script on the custom property to broadcast value updates. This would also require a Message Handler be put in place on View2 to listen for the broadcasts.

If you provide a better idea of how the Views will be used, I might be able to help a bit more.

1 Like

hello, view 2 will be embedded in view1 by passing parameters and dropconfig,udts. Could you please explain more how i can pass the custom property in view1 to view2. Thanks

Assuming you set up a param on View2 with a key of param_name, then you would create a new property in the EmbeddedView.props.params object with a matching key of `param_name, like so:
Screen Shot 2020-09-03 at 2.29.36PM

Secondly, bind that value against View1.custom.myCustomProp, like so:

Finally, within View2, make sure that you do indeed have the param in place and configured as an “Input”, like so:


Note that in this screenshot the param is using a default “fallback” value. It will use this value in the Designer, but during runtime that param will receive the value from the View1 view. You can change the default value to be anything you’d like, just know it will be replaced at runtime by whatever View1 supplies.

1 Like

hello, I am not sure if I make myself clear. My view 2 is a view that will be embedded into view 1 though drag-and-drop the udts. So view 2 pretty much is a template for all embedded views that are going to be dragged and dropped into view 1. I am think if I could pass a component property or a view custom property into view 2 (the template). Is this scenario still fall into A. View2 is Embedded View within View1 ? thanks!

I want to pass the text value from one view to another popup view event scripting.

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

popup_id = "IdPopupViewTwo"
system.perspective.openPopup(popup_id, "View2", params={"lot_number": self.getSibling("TextField").props.text, "id": popup_id})

This will use your “View2” view in a popup with an ID of “IdPopupViewTwo”, and supply lot_number as a parameter. View2 must have a configured param with the same key. I also like to pass the id of the popup in use so that I can properly close the popup. This also requires that the View in use accept an id param.

Then, in the Action attached to your onActionPerformed or onClick Event for the “Yes, Proceed” Button:

# logic to save the provided lot_number value should go here BEFORE closing the Popup, 
# most likely using something like system.db.runPrepUpdate.
# The lot_number param can be accessed at the self.view.params.lot_number address
system.perspective.closePopup(id=self.view.params.id)
1 Like

Thank you so much for your help.

I have added params as per your solution and by calling sp the record is getting saved into database and i have used table component in View1 so aftr clicking “Yes/proceed” button on view 2 the table data should get refresh so how can i do it in this case as table props not showing in view2 button script to use refreshbinding(“props.data”) so plz let me know solution for this …

If your Table is bound to some data which you’ve just updated, there are two ways to see that data update:

  1. Use a Message Handler pattern. This will require that the Popup “broadcast” a message at the page or session scope, and the table must then listen for that message at the page or session scope, and should then invoke self.refreshBinding('props.data')
  2. Place button within the same view as the table which will act as a binding refresh initiator. When the button is clicked, it will need to invoke self.getSibling('Table').refreshBinding('props.data')
1 Like

done as per your suggestion but data not updated on the table component (view 1)

this is on save button view 2:

system.perspective.sendMessage("refreshTable")

am I doing any mistakes?

The documented default scope for sendMessage is the page scope. If your table is listening at the session scope, then you must also broadcast at that scope.

system.perspective.sendMessage("refreshTable", scope="session")

Alternatively, you could have your Table listen at the Page scope instead.

1 Like

Could you explain how to do option (B)?

If you examine the screenshot above, you'l notice three checkboxes: Session, Page, and View. To have the Table listen for messages at the Page scope, you would make sure the Page checkbox is checked.

thanks!