# Perspective: Property change script on json returns QualifiedValues for all items

**URL:** <https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130>\
**Category:** Ignition\
**Tags:** perspective, ignition80\
**Created:** [December 2, 2020, 1:37pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130 "2020-12-02T13:37:18Z")\
**Posts on this page:** 12\
**Page:** 1

<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:** [December 2, 2020, 1:37pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/1 "2020-12-02T13:37:18Z")

</div>

Not sure if this is intended or not, but I have an array property that contains objects (json) with two keys. I have a change script on it and I’m using `currentValue.value` to get the json as py objects, however i’ve found that in order to see the value of items on the json, I need to use `.value` after each subscriptable access. It seems that all items within the json are QVs as well

E.g.

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

to read `options[0]['value']` I need to use:  
`currentValue.value[0].value['value'].value`  
So many `.value`s!  
Shouldn’t the QV only apply to the outer-most value? e.g. just the `currentValue`?

---

<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:** [December 2, 2020, 4:09pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/2 "2020-12-02T16:09:16Z")

</div>

Which version are you on? From what I remember, there were a couple bugs around this kind of thing late in 8.0; I _think_ 8.0.17 is supposed to have them fixed, but I’m not 100%.

---

<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:** [December 2, 2020, 7:54pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/3 "2020-12-02T19:54:34Z")

</div>

I’m on 8.1.0 lts

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [November 2, 2021, 5:09pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/4 "2021-11-02T17:09:55Z")

</div>

Is there a better way to do this now? I just dealt with a mess of .values in a change script that would be nice to avoid.

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [July 30, 2023, 6:42pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/5 "2023-07-30T18:42:17Z")

</div>

Looks like this is still hanging around in 8.1.28 or any chance there was a regression that brought this back to life? Definitely an annoying amount of `value` references to access the value you're after... Would it even be possible at this point to get rid of this behavior since I'm assuming so many deployments are now expecting all the sub objects to be QVs in scripts and would break on upgrade if this was changed?

 ![Screenshot 2023-07-30 at 2.30.09 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/47a75d0bd5c8200c890927ca891cc75f30b00178.jpeg)

---

<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:** [July 30, 2023, 9:27pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/6 "2023-07-30T21:27:23Z")

</div>

I would rather it fixed and have minor breaking changes to fix than have this to deal with though. So long as it's documented that it has changed. I haven't noticed this at all though tbh, although I'm not on 28 anywhere

---

<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 31, 2023, 2:31pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/7 "2023-07-31T14:31:21Z")

</div>

Anybody got a self contained view/project that demonstrates the problem?  
If it _does_ require breaking changes, 8.3.0 is the time to make them.

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [August 1, 2023, 4:29am UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/8 "2023-08-01T04:29:34Z")

</div>

I am able to reproduce with the table component and the default example data that is packaged with the table component by utilizing a change script on the `data` property (8.1.28). No changes to the component/data beyond adding the change script and editing a value in the data property to trigger the change script. If you're not seeing the same behavior on your end, let me know and I can send a self contained view.

 ![Screenshot 2023-08-01 at 12.20.28 AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8fdf634a40d15b34e509a121c51950f1c4f50861.jpeg)

---

<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:** [August 1, 2023, 9:25pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/9 "2023-08-01T21:25:20Z")

</div>

Thanks - that got me to the root of the issue, which is a code path that should've been fixed for 8.0.0 😬

I've made a strong suggestion to the Perspective team to get it fixed in 8.3.0.

---

<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:** [August 1, 2023, 9:29pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/10 "2023-08-01T21:29:44Z")

</div>

Is this why all my new iterator functions in Simulation Aids needed helpers to unqualify everything they encountered?

---

<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:** [August 1, 2023, 9:32pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/11 "2023-08-01T21:32:25Z")

</div>

Possibly? It's a static method in `com.inductiveautomation.perspective.gateway.binding.BindingUtils` that needs to be called. I'm not diving into the actual logic of _where_ the QV-containing-array-of-QVs behavior is originating. Some other time.

---

<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:** [August 1, 2023, 9:36pm UTC](https://forum.inductiveautomation.com/t/perspective-property-change-script-on-json-returns-qualifiedvalues-for-all-items/41130/12 "2023-08-01T21:36:11Z")

</div>

> [@paul-griffith](#):
>
> QV-containing-array-of-QVs

Yeah, that. And some friends of his.

I unqualify them with this:

```auto
    protected static class QualifiedArrayIterator implements Iterator<Object> {
        protected final Object[] source;
        protected int nextIdx = 0;

        protected QualifiedArrayIterator(Object[] source) {
            this.source = source;
        }

        @Override
        public boolean hasNext() {
            return nextIdx < source.length;
        }

        @Override
        public Object next() {
            Object retv = source[nextIdx++];
            if (retv instanceof QualifiedValue)
                retv = ((QualifiedValue) retv).getValue();
            return retv;
        }
    }

```
