Unfamiliar Scripting: component.initialize()

Hey folks,

I ran into a script / function that I’m unfamiliar with today and cannot seem to find it documented anywhere. Hoping someone can help point me to some documentation. The entirety of the property change script is as follows:

if event.propertyName == "ID":
		
	movingAI = event.source.getComponent('MAI')
	movingAI.initialize()

This is my first time seeing .initialize(), and can’t seem to find more information anywhere. What it should do seems intuitive to me, but I’d like to learn more about it.

Thanks.

Are you sure it isn’t a custom method on that control?
Go into scripting on the control and look at the methods.

1 Like

There are a lot of components that have an initialize() method which is accessible for technical reasons, but is not documented because we don’t intend for you to use them.

1 Like

Thanks, Kathy. Any where I could glean some more technical info? I’d like to replace the function of this script, but would like to understand it better. It’s a moving analog indicator, for what it’s worth.

@MMaynard - no scripting embedded on the controlled component, that I can see.

The Moving Analog Indicator doesn’t have an initialize() function in our code; are you sure it’s not a custom method? https://docs.inductiveautomation.com/display/DOC80/Custom+Component+Methods

1 Like

Thanks for pointing me in the right direction, Paul. There is a custom method there that I overlooked initially. I appreciate the help in what now seems like a silly question.

2 Likes

Not silly – if you aren’t used to using custom methods you wouldn’t think to look there. Glad you found it!

2 Likes