# Perspective - Bidrectional binding failure - StringArray\[0\] textfield

**URL:** <https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122>\
**Category:** Ignition Early Access\
**Tags:** perspective\
**Created:** [November 20, 2019, 9:09pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122 "2019-11-20T21:09:27Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 20, 2019, 9:09pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/1 "2019-11-20T21:09:27Z")

</div>

Please help me know how to update a tag from textfield value.

I tried checking bidirectional box hoping that when I clicked in a field, made an edit, then clicked or tabbed out that it would update the tag. It doesn’t it goes back to the original value.

I know this is a silly question, because I have scripted this exact thing in the past. I just cannot find my scripts or projects and I cannot find any examples of updating a tag from the client event or script on the IA site.

Thank you. Please link me if this is a duplicate… I couldn’t find it in the search.

Version: **8.0.5 (b2019101516)**

- Linux | amd64
- 11.0.4+11-LTS

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 20, 2019, 10:04pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/2 "2019-11-20T22:04:55Z")

</div>

I found this… but no code snippets yet…  
Is this what I am looking for? How to I use this? Auto change would be nice, but submitting all changes at once with a button is also needed. I see ways to script everything but writing back to the tags/device.

[system.tag.writeAsync](https://docs.inductiveautomation.com/display/DOC80/system.tag.writeAsync)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 20, 2019, 10:43pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/3 "2019-11-20T22:43:06Z")

</div>

You shouldn’t need to do anything so fancy; A bidirectional binding should absolutely be enough and should be working. I was able to set up such a bi-directional Tag/Text Field combo in just a few seconds without issue.

Could you provide a screenshot of your binding, along with the path of your tag?

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 21, 2019, 1:01pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/4 "2019-11-21T13:01:20Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/ac628312ef08cd64155b10917ebea5967cc61637.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/429d036eb6278bb75c26599caade8514879f5ec7.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 21, 2019, 3:18pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/5 "2019-11-21T15:18:29Z")

</div>

That looks correct.  
To continue looking into this I’ll need a couple of things:

1. A single screenshot which shows the Text Field and the binding dialog side by side, with a different value in the Text Field than is displayed in the binding dialog.
2. A copy of the View in question via Direct Message.
3. What exact type of tag is being used here? It looks like this a String Array Tag, but I’d like to be sure.
4. What version are you using?

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 21, 2019, 10:01pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/6 "2019-11-21T22:01:10Z")

</div>

It is a StringArray.  
The Text Field data is populated by the tag value.  
I wanted to change the tag value by updating the text field.  
This works well in the vision module with:

```auto
value = event.source.parent.getComponent('Text Field').text
system.tag.write('[default]OPC_Nano1/SomeObject/Contents[0]', value)

```

How would I to the same in perspective?

```auto

def runAction(self, event):
myValue = self.getSibling("TextField").props.text
system.tag.writeAsync('[default]OPC_Nano1/SomeObject/Contents[0]', myValue, howToCallBack)

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 21, 2019, 10:31pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/7 "2019-11-21T22:31:47Z")

</div>

You shouldn’t do this with a script. Your bi-directional binding should be enough; this is why I requested a screenshot which shows a differing value in the text from what the binding dialog shows you.

Provided nothing else than you have configured a bi-directional binding on `TextField.props.text`- as you have configured in your earlier screenshot - what happens to the tag value when you change the value of `TextField.props.text`?

In other words, please change the value of `TextField.props.text` to be `88888888888049`, and then please take your screenshots again and post them here.

---

<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:** [November 21, 2019, 10:43pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/8 "2019-11-21T22:43:03Z")

</div>

If the underlying tag is a single precision floating point number, the change from 88888888888048 to 88888888888049 won’t register–it’s below the minimum change possible. It can’t be Int4, as that won’t hold such a large value at all.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 21, 2019, 10:45pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/9 "2019-11-21T22:45:08Z")

</div>

It's a String Array tag.

> [@ecujak](#):
>
> It is a StringArray.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 22, 2019, 2:41pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/10 "2019-11-22T14:41:08Z")

</div>

I don’t know what that last comment means. The data type is String Array.

When I change the value of the text field, the tag is not updated. In 2.5 seconds, the text field is changed back to the original tag value(or the current tag value, since it wasn’t updated). If I move out of the text field (Unfocus), the value is immediately reset to the existing tag value.

In vision I have the same problem with bi-directional binding. In vision I am able to script the change successfully.

I really want to use perspective for more reasons than anyone wants to read on this thread. Please help.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6a65ebe817082e9f123e5802923a694b3fb66fa7.png)

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 22, 2019, 3:14pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/11 "2019-11-22T15:14:06Z")

</div>

Ok…

So if I change TextField binding to:

```auto
[default]OPC_Nano1/SomeObject/Contents

```

The Text Field data is encapsulated inside Open Bracket, Open Double Quote, Close Double Quote, Close Backet.

```auto
["MyText"]

```

With this I am able to update the tag by changing the text inside [""]

I need to be able to edit the array index directly, without handling the [""].

Is this a bug, or by design. How can I use this properly.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 22, 2019, 3:23pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/12 "2019-11-22T15:23:16Z")

</div>

So this sends lots of crazy stuff to the tag.

`Tag value -> OriginalText -> Defualt TextField representation -> ["OriginalText"] ->["NewText"]-> tag updated to -> "NewText"-> text updated from tag to text field-> ["\"NewText\""]`

If there is a comma in the Text… well … it gets really messy.

`["\"What just happened\""]`

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 22, 2019, 3:33pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/13 "2019-11-22T15:33:23Z")

</div>

I’m not able to replicate your issue, so I’ll have to recommend that you get in contact with our support team. Please make sure your reference this thread so that they can easily see what you’re encountering.

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 22, 2019, 5:05pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/15 "2019-11-22T17:05:29Z")

</div>

Button OnClick:

```auto
def runAction(self, event):
	myValue = self.getSibling("TextField").props.text
	system.tag.writeAsync(["[default]OPC_Nano1/SomeObject/Content"], [myValue])

```

---

<div class="post-metadata">

**Author:** ![ecujak](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@ecujak](https://forum.inductiveautomation.com/u/ecujak)\
**Post date:** [November 22, 2019, 5:06pm UTC](https://forum.inductiveautomation.com/t/perspective-bidrectional-binding-failure-stringarray-0-textfield/30122/16 "2019-11-22T17:06:05Z")

</div>

Other examples show that callBack is not required. Bidirectional binding is still broken. The script works. Thanks. I prefer the script anyway.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f6c2a841372a695ecf337a46b737199de94e389b.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/80acaddfef3231796b829758258db6df321eed0b.png)
