# Bind DataSet to a Label component

**URL:** <https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [February 24, 2024, 8:53am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305 "2024-02-24T08:53:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henrol\_Jeo\_Gutierrez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrol_jeo_gutierrez/32/50993_2.png) [@Henrol\_Jeo\_Gutierrez](https://forum.inductiveautomation.com/u/Henrol_Jeo_Gutierrez)\
**Post date:** [February 24, 2024, 8:53am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/1 "2024-02-24T08:53:50Z")

</div>

Hi I wonder if this is possible, I have a Named Queries that return 1R x 13C dataset.  
This is the sample returned Data:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1db343d8fe34e2121f73fea03a064114745c49f0.png)

What I want is to bind for example the sku\_code value to my Label and all other info, but I don't know how to do it.  
This is what I am thinking to do it, but I know this is stupid:

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

I only want a specific column to point on that specific label.

Thanks and Regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [February 24, 2024, 9:08am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/2 "2024-02-24T09:08:08Z")

</div>

To be clear: Each of the labels should receive a value from one of the columns in your dataset, right ?

Create a custom property and bind it to your query.  
Now each label can bind to that dataset and pull just one of the value

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 24, 2024, 9:14am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/3 "2024-02-24T09:14:44Z")

</div>

It looks like you are already pulling in the dataset to the label's text property. If you're using an expression binding to do this, the binding should be written like this to pull in the individual value:

```auto
{DatasetProperty}[0, "Column Name"]

```

That said, it is possible that you will want to add a `try()` to your expression, so you'll still return a default value whenever there are no rows in the dataset.

---

<div class="post-metadata">

**Author:** ![Henrol\_Jeo\_Gutierrez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrol_jeo_gutierrez/32/50993_2.png) [@Henrol\_Jeo\_Gutierrez](https://forum.inductiveautomation.com/u/Henrol_Jeo_Gutierrez)\
**Post date:** [February 24, 2024, 9:17am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/4 "2024-02-24T09:17:45Z")

</div>

I actually tried this: I saw from other post,

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

but gives me this error:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/7/6733f7d0aa77cab8d57acd02b53e10cb26dcb75a.png)

---

<div class="post-metadata">

**Author:** ![Henrol\_Jeo\_Gutierrez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrol_jeo_gutierrez/32/50993_2.png) [@Henrol\_Jeo\_Gutierrez](https://forum.inductiveautomation.com/u/Henrol_Jeo_Gutierrez)\
**Post date:** [February 24, 2024, 9:20am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/5 "2024-02-24T09:20:14Z")

</div>

I actually done it..  
To give more info, this is a pop-up window.  
I give custom properties of the pop-up with the ff:

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

data is my dataSet (as seen I think it queries successfully)  
Now my problem is to pull one column of that data and bind it to specific property (like Label.text)

---

<div class="post-metadata">

**Author:** ![Henrol\_Jeo\_Gutierrez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrol_jeo_gutierrez/32/50993_2.png) [@Henrol\_Jeo\_Gutierrez](https://forum.inductiveautomation.com/u/Henrol_Jeo_Gutierrez)\
**Post date:** [February 24, 2024, 9:27am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/6 "2024-02-24T09:27:02Z")

</div>

It strange, even though it has an error, that code works.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 24, 2024, 9:35am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/7 "2024-02-24T09:35:35Z")

</div>

I imagine that the error you are seeing is being caused by the fact that there are initially no rows, so the zero index in the binding breaks. Then, the binding subsequently starts working when the row is returned by the query. The `try()` expression should fix that. Simply have it return a blank string when no rows are present.

For your use case, the expression binding will look like this:

```auto
try({DatasetProperty}[0, "Column Name"], "Value to return if expression fails")

```

---

<div class="post-metadata">

**Author:** ![Henrol\_Jeo\_Gutierrez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrol_jeo_gutierrez/32/50993_2.png) [@Henrol\_Jeo\_Gutierrez](https://forum.inductiveautomation.com/u/Henrol_Jeo_Gutierrez)\
**Post date:** [February 24, 2024, 9:47am UTC](https://forum.inductiveautomation.com/t/bind-dataset-to-a-label-component/86305/8 "2024-02-24T09:47:47Z")

</div>

Thanks for this!
