# How do I bind a property adapter to a specific Tag in code?

**URL:** <https://forum.inductiveautomation.com/t/how-do-i-bind-a-property-adapter-to-a-specific-tag-in-code/15868>\
**Category:** Module Development\
**Created:** [November 3, 2017, 3:16pm UTC](https://forum.inductiveautomation.com/t/how-do-i-bind-a-property-adapter-to-a-specific-tag-in-code/15868 "2017-11-03T15:16:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmckinnon](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mmckinnon](https://forum.inductiveautomation.com/u/mmckinnon)\
**Post date:** [November 3, 2017, 3:16pm UTC](https://forum.inductiveautomation.com/t/how-do-i-bind-a-property-adapter-to-a-specific-tag-in-code/15868/1 "2017-11-03T15:16:16Z")

</div>

I am trying to change the Tag binding for a numeric label’s property ‘Mouseover Text’ from Tagname.toolTipText to Tagname.LastUpdated. I am able to retrieve the value of the property adapter for this component’s property, and I am able to clear the property adapter, but I can’t figure out how to set it. How do you instantiate the ‘pa’ in the setPropertyAdapter method ‘setPropertyAdapter(java.awt.Component c, java.lang.String propName, PropertyAdapter pa)’. A specific code example would be appreciated. I have reviewed the SDK and can’t figure this one out.

Thanks!

Here is the code snipet I have so far:

#get property adapter  
w = system.gui.getWindow(‘Main Windows/WQYork’)  
c = w.getRootContainer().getComponent(‘nlbl\_WP\_Curr’)  
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)  
print pa  
_returns York/PH\_CURR\_WP.Tooltip --\> nlbl\_WP\_Curr.toolTipText_

#remove the property adapter (must be removed before setting one?)  
w.interactionController.removePropertyAdapter(c, ‘toolTipText’)  
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)  
print pa  
_returns None_

#set property adapter for component ‘Mouseover Text’ property  
pa = ‘York/PH\_CURR\_WP.LastChange --\> nlbl\_WP\_Curr.toolTipText’ # this is what I want the Tag binding to be  
w.interactionController.setPropertyAdapter(c,‘toolTipText’,pa)  
pa = w.interactionController.getPropertyAdapter(c,‘toolTipText’)  
print pa

_Returns Traceback (most recent call last):_  
\_ File “”, line 3, in \_  
_TypeError: setPropertyAdapter(): 3rd arg can’t be coerced to com.inductiveautomation.factorypmi.application.binding.PropertyAdapter_

---

<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:** [November 3, 2017, 3:36pm UTC](https://forum.inductiveautomation.com/t/how-do-i-bind-a-property-adapter-to-a-specific-tag-in-code/15868/2 "2017-11-03T15:36:41Z")

</div>

You are treading on dangerous and unstable ground. There is no support for manipulating binding like this.  
The supported way to do this is to use an indirect tag binding and change the string property as needed.
