# View properties - Issue

**URL:** <https://forum.inductiveautomation.com/t/view-properties-issue/57832>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 30, 2022, 8:00pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832 "2022-03-30T20:00:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gdube/32/41701_2.png) [@gdube](https://forum.inductiveautomation.com/u/gdube)\
**Post date:** [March 30, 2022, 8:00pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/1 "2022-03-30T20:00:44Z")

</div>

Hi guys, if anyone can explain to me what’s going on, I’d appreciate.

I made a view on which I added an object property `x`, which has an integer member named `y`.  
Then I added a button with the following onClick script:

```auto
custom = self.view.custom
x = custom.x
x.y = x.y + 1 
system.perspective.print('x.y: %s' % x.y)
system.perspective.print('custom.x.y: %s' % custom.x.y)

```

And clicking on the button gives me this…

 ![Setup.1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a5a3330a7455e7ffac430e3b14029ac8aaef25b1.png)

In other words, after incrementing `x.y`:

- `x.y` returns the previous value.
- `custom.x.y` returns the current value.

I don’t get it :s

---

<div class="post-metadata">

**Author:** ![awaege1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/awaege1/32/28922_2.png) [@awaege1](https://forum.inductiveautomation.com/u/awaege1)\
**Post date:** [March 30, 2022, 8:09pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/2 "2022-03-30T20:09:10Z")

</div>

You are not setting the value back to the actual parameter and are just referencing your local variables. You have to remember that you are not actually getting a reference the custom property when setting your variable to self.view.custom, you are just copying it’s value into a new variable. To get the functionality you desire, do something like the following:

```auto
x = self.view.custom.x #Get the value currently in the property 
y = x['y'] #or x.y but I like json notation
y += 1 #Increment your counter
self.view.custom.x.y = y #set the actual property to the new value
system.perspective.print(self.view.custom.x.y)

```

---

<div class="post-metadata">

**Author:** ![gdube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gdube/32/41701_2.png) [@gdube](https://forum.inductiveautomation.com/u/gdube)\
**Post date:** [March 30, 2022, 8:18pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/3 "2022-03-30T20:18:39Z")

</div>

What’s troubling me is that assigning `y` via the `x` copy will increment `self.view.custom.x.y`, but not the `x` copy. As if there’s a redirection on the copy, or the copy is read-only ?

---

<div class="post-metadata">

**Author:** ![awaege1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/awaege1/32/28922_2.png) [@awaege1](https://forum.inductiveautomation.com/u/awaege1)\
**Post date:** [March 30, 2022, 8:26pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/4 "2022-03-30T20:26:43Z")

</div>

In your example you were never incrementing self.view.custom.x.y at all. You had written:

```auto
custom = self.view.custom

```

Which is creating a copy of the custom property object.

You then had

```auto
x = custom.x

```

which is now a new separate variable, independent of “custom”

When you did

```auto
x.y = x.y + 1

```

you now successfully incremented object y of object x. Since “custom” is still a completely separate variable, the object custom.x.y is still the original value.

In general never assign the entirety of the custom properties to a single variable inside a script since that can get confusing fast. Try to assign each custom property object to it’s own variable:

```auto
x = self.view.custom.x

```

then perform any operation on the object and it’s children

```auto
x.y = x.y + 1

```

Then update the custom property by setting the value to your object

```auto
self.view.custom.x = x

```

---

<div class="post-metadata">

**Author:** ![gdube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gdube/32/41701_2.png) [@gdube](https://forum.inductiveautomation.com/u/gdube)\
**Post date:** [March 30, 2022, 8:34pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/5 "2022-03-30T20:34:35Z")

</div>

Well it’s somehow incrementing the real thing, see the output when I click on the button repeatedly.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/2/72e5bac3c8cf771ea35da6af39de8cf8b0be5545.png)

I agree I’ll avoid it now that I know the pitfalls. It’s still a strange behavior to me, and I can’t explain to myself how the copy affects the real property but not itself.

---

<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:** [March 30, 2022, 9:09pm UTC](https://forum.inductiveautomation.com/t/view-properties-issue/57832/6 "2022-03-30T21:09:50Z")

</div>

It’s basically just a bug.  
There’s a lot of smoke and mirrors happening so that these things pretend to be native Python data structures. When you rebind them, that (currently causes this weird behavior.
