# Perspective Tag Changed By Tracking

**URL:** <https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [January 23, 2025, 9:21pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318 "2025-01-23T21:21:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 23, 2025, 9:21pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/1 "2025-01-23T21:21:41Z")

</div>

Good Afternoon All,

I have a perspective view with a dropdown list that I have assigned to a tag (NewState) and is set to historical which is connected to my Canary Labs Historian. I want to capture the current, logged in user (session.props.auth.user.userName), into another tag (stateChangedBy) when the user has chosen a new value from the dropdown list. Essentially, I am trying to capture who changed the the (NewState) tag in my historian. I have verified that session.props.auth.user.userName gives me the user data I want, and the tag value change from the dropdown list to be trigger of writing the user name to my (StateChangedBy) tag. Additionally, I would like to show the new state value and who changed it in my historical table, which should be good to go when I get the first part working. Any help would be much appreciated, thank you for your time!

Regards,

Tim

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/d/cd18c54f88b94cb5251718d6e41442db09a5cf69.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 23, 2025, 9:26pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/2 "2025-01-23T21:26:04Z")

</div>

I use audit logs for this  
[Audit Log and Profiles | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/platform/audit-log-and-profiles)

---

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 23, 2025, 9:39pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/3 "2025-01-23T21:39:20Z")

</div>

Hey DK,

Thank you for the quick reply. After reading up about the Audit Log, the user's name that changed the dropdown list tag must also go into my Canary data historian, which I am reading back in my historical table shown. Although I am showing the historical machine state and state changed by in Ignition, there are other audiences that need the data outside of ignition, direct from the Canary Historian through it's visualization web app, Axiom.

Regards,

Tim

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 23, 2025, 9:55pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/4 "2025-01-23T21:55:46Z")

</div>

The audit log will capture the user as `actor.` When you create an audit profile, you chose which database the information is stored in. I'm not 100% sure, but you should be able to select Canary as your database target.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb3adb95e2a218796c062650350e83b8f770d621.png)

---

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 23, 2025, 10:47pm UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/5 "2025-01-23T22:47:12Z")

</div>

Hey DK,

Unfortunately Canary is not an option for an audit log target, because it is time-series and not relational. I have the trigger in place for the drop down and is wiritng to StateChangedBy tag, but I cannot get it to populate with the session.props.auth.user.userName value. I'm sure it's my syntax....

```python
def runAction(self, event):
	tagPath = ["[default]Drill_Room/Hitachi/ND-1V284E/K130877011-K130877022_MAE-E002/StationStateChanged/StateChangedBy"]
	currentUser = session.props.auth.user.userName
	system.tag.writeBlocking(tagPath, currentUser)

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/127c333801060d4a91eaa237817ea3c3d887621d.png)

---

<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:** [January 24, 2025, 12:59am UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/6 "2025-01-24T00:59:13Z")

</div>

Highlight everything after `currentUser = ` and then use the property selector dialog UI on the right to pick it. Then you'll see the nuanced difference.

---

<div class="post-metadata">

**Author:** ![Timothy\_Vertin](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@Timothy\_Vertin](https://forum.inductiveautomation.com/u/Timothy_Vertin)\
**Post date:** [January 24, 2025, 1:15am UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/7 "2025-01-24T01:15:07Z")

</div>

Thank you so much Phil!!

How the heck would I have found this out on my own? Could you expand on how "self." got me to the proper value write to my tag? Thanks again sir!

```python
def runAction(self, event):
	tagPath = ["[default]Drill_Room/Hitachi/ND-1V284E/K130877011-K130877022_MAE-E002/StationStateChanged/StateChangedBy"]
	currentUser = self.session.props.auth.user.userName
	system.tag.writeBlocking(tagPath, currentUser)

```

---

<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:** [January 24, 2025, 1:36am UTC](https://forum.inductiveautomation.com/t/perspective-tag-changed-by-tracking/101318/8 "2025-01-24T01:36:12Z")

</div>

Jython functions get just their arguments, and have just a few other built-ins in scope. `session` is not a built-in.

In Ignition's expression language, curly braces have more predefined names.

Expressions are not jython, nor vice versa.
