# Accessing the componentRunning property of a component?

**URL:** <https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [July 16, 2020, 2:08pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772 "2020-07-16T14:08:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 16, 2020, 2:08pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/1 "2020-07-16T14:08:55Z")

</div>

I’m using

```auto
if event.propertyName == 'componentRunning' and event.newValue and event.source.columnName != '':
	initialValue = int(system.db.runScalarQuery("SELECT %s FROM listusers WHERE idx = %i"%(event.source.columnName, system.tag.read('[client]userId').value)))
	print "initializing dd_Dates to %i"%(initialValue)	
	event.source.dd_dates = initialValue

```

to initialize a template values.

Later, I also want to update, but I want to add the componentRunning as part of the conditional like this

```auto
if event.propertyName == 'dd_dates' and event.source.componentRunning:
	event.source.finalDateType = event.newValue
	if event.source.columnName != '':
		qry = "UPDATE listusers SET %s = %i WHERE idx = %i"%(event.source.columnName, event.newValue, system.tag.read('[client]userId').value)
		print "update date selection qry: " + str(qry)
		system.db.runUpdateQuery(qry)

```

However, I am getting an error

```auto
Traceback (most recent call last):
  File "<event:propertyChange>", line 15, in <module>
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'componentRunning'

```

Why is it I can catch the propretyChange event for componentRunning but can’t access it after that? Is there a way to access it?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 16, 2020, 2:15pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/2 "2020-07-16T14:15:11Z")

</div>

I believe it is `event.source.COMPONENT_RUNNING`

Edit: Nevermind, this appears to a be a string proeperty that is always equal to “componentRunning”.

---

<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:** [July 16, 2020, 2:21pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/3 "2020-07-16T14:21:03Z")

</div>

A PropertyChange event can be generated programmatically, with no actual property to back it up, just some state machine. I would not trust `COMPONENT_RUNNING`, if I were you.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 16, 2020, 2:26pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/4 "2020-07-16T14:26:49Z")

</div>

Yea just realized that. COMPONENT\_RUNNING was not helpful. I just made a new internal boolean property that I turn on/off to track this.

However, are you also saying I can’t trust componentRunning in general? I do see that sometimes my other custom properties get triggered before it, so I’m not exactly sure what it’s signifying.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 16, 2020, 3:25pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/5 "2020-07-16T15:25:20Z")

</div>

`COMPONENT_RUNNING` events are fired for all classes that implement the `ComponentLifecycle` interface. With some edge cases, they’ll be fired whenever the component is added to its container by the layout manager. I don’t think any guarantees are made about order of operations/evaluations with regard to bindings.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 16, 2020, 3:27pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/6 "2020-07-16T15:27:21Z")

</div>

Just from what I observe in the print statements, it seems like a template instance runs through all custom properties/template properties once for some initial value action I would think, then triggers componentRunning, and then each property gets hit agian.

---

<div class="post-metadata">

**Author:** ![19tb21](https://avatars.discourse-cdn.com/v4/letter/1/0ea827/32.png) [@19tb21](https://forum.inductiveautomation.com/u/19tb21)\
**Post date:** [July 20, 2023, 9:26pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/7 "2023-07-20T21:26:05Z")

</div>

> [@paul-griffith](#):
>
> `ComponentLifecycle` interface

is there documentation/list somewhere of which components/classes use this in Ignition?

---

<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:** [July 20, 2023, 9:31pm UTC](https://forum.inductiveautomation.com/t/accessing-the-componentrunning-property-of-a-component/36772/8 "2023-07-20T21:31:44Z")

</div>

> [@19tb21](#):
>
> documentation/list somewhere of which components/classes use this in Ignition?

Right at the top of the java doc (darn near everything):

[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/vision/api/client/components/model/ComponentLifecycle.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/vision/api/client/components/model/ComponentLifecycle.html)
