# Question about Objects vs. Properties

**URL:** <https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261>\
**Category:** Ignition\
**Created:** [October 21, 2019, 6:52pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261 "2019-10-21T18:52:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard.d.white](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@richard.d.white](https://forum.inductiveautomation.com/u/richard.d.white)\
**Post date:** [October 21, 2019, 6:52pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/1 "2019-10-21T18:52:44Z")

</div>

Can someone please point me to a reference where this is better explained?

I understand that tags as created with Ignition are Objects that have properties associated with them. For example, if I want to see the LastChange property associated with a tag, I would in scripting put something like:

tagslastchange = system.tag.read(‘mytag.LastChange’)

However, if I simply try to print tagslastchange to the console I get something like: [Mon Oct 21 07:27:50 HST 2019, Good, Mon Oct 21 08:48:35 HST 2019]

To properly derive the desired information I wanted (the last time the tag changed) I need to further filter by typing something like print tagslastchange.value.

This is where I’m confused. Is LastChange just a property of it’s tag or a “sub-Object” with it’s own properties? Can someone point me to documentation where this is explained? Also what other tag properties have this feature where they appear to be “sub-Objects”?

Thanks!!

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 21, 2019, 6:58pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/2 "2019-10-21T18:58:41Z")

</div>

when you use system.tag.read() it returns a qualified tag value. If all you want is the value in the tag you need to put .value at the end so in your case

```auto
tagslastchange = system.tag.read(‘mytag.LastChange’).value

```

Your other options from the read is .quality and .timestamp. I believe .timestamp would also give you your last change value so you could do:

```auto
tagslastchange = system.tag.read(‘mytag’).timestamp

```

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [October 21, 2019, 7:02pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/3 "2019-10-21T19:02:54Z")

</div>

I should of also posted the link to [system.tag.read()](https://docs.inductiveautomation.com/display/DOC79/system.tag.read). This is from 7.9. I’m not sure what version your using. But for the last part of your question. The LastChange is a property of the tag but when you put it in the tag read it becomes the object that your pulling and still has to be returned as a qualified value. This is why you need to add the extra piece of either .value, .quality, or .timestamp to any tag your reading with a script to pull the part of the qualified value you want out of it.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 21, 2019, 7:59pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/4 "2019-10-21T19:59:29Z")

</div>

As stated by @bpreston, `system.tag.read` returns an object of class `BasicQualifiedValue`. This class object has its own set of methods and properties, some of which are value, timestamp, and quality. You can check what class type an object is by using the `type` function. E.g. Type(tag). You can look at the class definitions here: [http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/index.html](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/index.html)

What I still don’t really understand, is how you can write tag.value to get the value, without having to call tag.getValue() as you can see in the Java doc definition of the QualifiedValue interface… I’m still a baby to Java

---

<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:** [October 21, 2019, 8:05pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/5 "2019-10-21T20:05:53Z")

</div>

`qv.value` working _isn’t_ a Java thing - it’s actually a bit of Jython “magic”.

_Lots_ of things in Java conform to the ‘javabeans’ style - classes with private fields, but public getter and setter methods. This is very verbose, and “idiomatic” Python doesn’t use getters/setters (although you _can_). So, to make working with Java classes more “idiomatic” from Jython, Jython does some pretty magical stuff to turn methods like `getSomeProperty()/setSomeProperty()` into an _attribute_ `someProperty` - so `<qualified value object>.getValue()` is also available as an attribute `<qualified value>.value` when you’re looking at the class from Jython.

There’s no strong reason to use one or the other - one is more idiomatic Python, but relies on “magical” Jython automatic handling, the other is (much) more verbose and just makes your Python code look like Java code.

---

<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:** [October 21, 2019, 8:16pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/6 "2019-10-21T20:16:13Z")

</div>

> [@paul-griffith](#):
>
> just makes your Python code look like Java code.

Yeah, don't do that. /:  
Auto-conversion of java getters and setters to python properties is a critical feature, IMNSHO. Jython would be a much more miserable place without it.

---

<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:** [October 21, 2019, 8:33pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/7 "2019-10-21T20:33:27Z")

</div>

Let me elaborate:

Jython “wraps” Java objects for use in its interpreter. The standard wrappers basically do this:

1. Public fields in java become matching properties in Jython. Read-write if the java doesn’t use `final`.
2. Public methods in java become matching methods in Jython. When multiple methods share the same name–different argument lists–they are wrapped into the same jython method, and picking the correct one is deferred until called. Which looks at the number of arguments given.
3. Public methods of the form `getAbcdEfgh()` (no arguments) will be turned into a readable property named `abcdEfgh`. Unless a public java field already has that name (iirc). If the java return value is boolean, the method `isAbcdEfgh()` is treated the same. Note the case change in the first letter of the property name.
4. Public methods of the form `setAbcdEfgh(SomeType v)` (just the one argument) will be turned into a writeable property named `abcdEfgh`, combining with the getter above if present. The `SomeType` in the `set` form must match the return type of the `get` form. This feature allows you to put the emulated property on the left-hand side of an assignment in jython.

Non-standard wrappers (like the PyComponentWrapper in Vision) can do anything they want, including leaving out features that the standard wrapper would include.

---

<div class="post-metadata">

**Author:** ![richard.d.white](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@richard.d.white](https://forum.inductiveautomation.com/u/richard.d.white)\
**Post date:** [October 22, 2019, 5:27pm UTC](https://forum.inductiveautomation.com/t/question-about-objects-vs-properties/29261/8 "2019-10-22T17:27:39Z")

</div>

To everyone who responded, THANK YOU for your explanations! I am continually impressed by the power of Ignition… Despite having used this for the past 1-2 years I’m still learning and having the forums available are a wonderful resource. Again, thanks!
