# Data in label with script

**URL:** <https://forum.inductiveautomation.com/t/data-in-label-with-script/63682>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [September 1, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/data-in-label-with-script/63682 "2022-09-01T15:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [September 1, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/data-in-label-with-script/63682/1 "2022-09-01T15:14:56Z")

</div>

Good morning, I want to display the data that has two tags (memory tags that I can change manually from the designer) without binding because I need different instances of the window that is going to show two labels.  
Example:

```auto

Part 1
Labels | Reading Tag | Display label 
lblCanalTag | 04 | 04                  
lblSectorTag | 07 | 07
Then, the instance of the window open and show it

Part2 (without close the first window that is open)
Labels | Reading Tag | Display label 
lblCanalTag | 08 | 08          
lblSectorTag | 010 | 010

```

Then, the instance of the window open and show it, so I have two instances now.

But I tried printing the data if the tag was reading because did not show the data in the labels, and it open various windows but are empty.

I have this code:

```auto
#Labels
lblCanalTag = system.gui.getParentWindow(event).getComponentForPath('Root Container.lblCanalTag').text
lblSectorTag = system.gui.getParentWindow(event).getComponentForPath('Root Container.lbSectorTag').text

#Reading tags
tgCanal = system.tag.readBlocking("[default]app_tags/Componentes/ArranquePedidos/Alarma_Canal_Vacio")
tgSector = system.tag.readBlocking("[default]app_tags/Componentes/ArranquePedidos/Alarma_Sector_Vacio")

#set text in the display of the label
lblCanalTag=tgCanal
lblSectorTag=tgSector

```

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [September 1, 2022, 3:39pm UTC](https://forum.inductiveautomation.com/t/data-in-label-with-script/63682/2 "2022-09-01T15:39:00Z")

</div>

Hi @Esmeralda_Lopez

I would take a look at the [documentation](https://docs.inductiveautomation.com/display/DOC81/system.tag.readBlocking) for the readBlocking function. It is expecting the first parameter to be a list and returns a list. I would suggest probably doing this with [readAsync](https://docs.inductiveautomation.com/display/DOC81/system.tag.readAsync) using a callback to set the labels text with the read value.

Also, It seems like you could probably accomplish this with an [Indirect Tag Binding](https://docs.inductiveautomation.com/display/DOC81/Indirect+Tag+Bindings+in+Vision) removing the requirement to script this entirely.

Hope that points you in the right direction!  
JJ Coffman

---

<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:** [September 1, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/data-in-label-with-script/63682/3 "2022-09-01T15:51:05Z")

</div>

> [@jcoffman](#):
>
> doing this with [readAsync](https://docs.inductiveautomation.com/display/DOC81/system.tag.readAsync) using a callback

In a Vision client, are callbacks on the UI thread? (I assumed **not**.) Setting the label from a callback that isn't on the UI thread requires the use of `system.util.invokeLater` and embedding a component reference in the callback. Ugly.

Indirect Binding is the correct answer.
