# Attaching generated list to a data table for a pop up window

**URL:** <https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072>\
**Category:** Ignition\
**Created:** [June 15, 2023, 12:17pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072 "2023-06-15T12:17:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurkirat\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Gurkirat\_Singh](https://forum.inductiveautomation.com/u/Gurkirat_Singh)\
**Post date:** [June 15, 2023, 12:17pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/1 "2023-06-15T12:17:47Z")

</div>

Hello Everyone,

**Application** : I have accumulation section with 24 beds and there's individual PE's for each section. I want to create a pop up window with all the PE's listed in table to show where exactly the jam is using the following script.

step 1: I have multiple tags that I'm reading form a folder for an accumulation zone with 24 tags. so naturally built a tagpath list to read from.  
step 2: read all the tags and used list comprehension to generate another list to store values that i read.  
\*\*\*\ ***part I'm currently cant get past is step 3**  
step 3: tag\_value\_list is what I'm trying to attach to a data table. and where should I apply this script on. possibilities i have considered so far (button action performed, project scripts).

```auto
acc_number = 12093701
bed_number = 24
end_acc_number = acc_number + bed_number
x = [item for item in list(range(acc_number, end_acc_number))]
print(x)

#tag_base_path = "JAM_PHOTOEYES/12093730/1209370"
tag_base_path = "JAM_PHOTOEYES/12093730/"
tag_paths = []
# These two for loops iterate over a range and generate tag paths for us to read from
for i in x:
    tag_path = tag_base_path + str(i)+"/AFE_Recirc_Pecblockage"
    tag_paths.append(tag_path)

# this line reads all the tags at the path we specified
tag_values = system.tag.readAll(tag_paths)
#this list comprehension allows us to wrap all the values read in a list for us
tag_value_list = [tag.value for tag in tag_values]

# new to convert list into a dataset and bind data property of the table to this dataset tag
print(tag_value_list)

```

 ![code_snipped_pecblockupdate](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/faeaf3f756edfc1273c154b60472a9e3ee1614e4.png)

---

<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:** [June 15, 2023, 12:23pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/2 "2023-06-15T12:23:31Z")

</div>

Please edit your post, highlight all of the code, then click the "preformatted text" button on the comment editor. This will make your code readable for us.

---

<div class="post-metadata">

**Author:** ![Gurkirat\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Gurkirat\_Singh](https://forum.inductiveautomation.com/u/Gurkirat_Singh)\
**Post date:** [June 15, 2023, 12:30pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/3 "2023-06-15T12:30:03Z")

</div>

Thank you for your suggestion!!

---

<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:** [June 15, 2023, 12:32pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/4 "2023-06-15T12:32:58Z")

</div>

So, you need to use the [system.dataset.toDataSet](https://docs.inductiveautomation.com/display/DOC81/system.dataset.toDataSet) function to convert from lists to a dataset. Note that it needs a **list of lists** , where the inner list represents the row.

(Lots of examples scattered over the forum.)

---

<div class="post-metadata">

**Author:** ![Gurkirat\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Gurkirat\_Singh](https://forum.inductiveautomation.com/u/Gurkirat_Singh)\
**Post date:** [June 15, 2023, 12:42pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/5 "2023-06-15T12:42:29Z")

</div>

so according to the manual parameters/arguments this function calls for is (header, rows). However, when I do so it gives me error showed in the pictures.  
`PecblockageDataset = system.dataset.toDataSet("value",tag_value_list)`

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

---

<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:** [June 15, 2023, 12:43pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/6 "2023-06-15T12:43:48Z")

</div>

In your code, `tag_value_list` is not a list of lists (yet). Consider something like this for `rows`:

```auto
[[x] for x in tag_value_list]

```

---

<div class="post-metadata">

**Author:** ![Gurkirat\_Singh](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@Gurkirat\_Singh](https://forum.inductiveautomation.com/u/Gurkirat_Singh)\
**Post date:** [June 15, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/7 "2023-06-15T13:55:54Z")

</div>

Thank you!. Now that I have a dataset to work with. can you guide me through the last process/question i had for this problem. where should i apply to script to? action performed on the button? and how can I link to data table in my pop window?

---

<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:** [June 15, 2023, 1:59pm UTC](https://forum.inductiveautomation.com/t/attaching-generated-list-to-a-data-table-for-a-pop-up-window/75072/8 "2023-06-15T13:59:02Z")

</div>

From a script, you would assign the dataset to a component's data property. Or to a property that fed a binding to the actual display property. Or provide the dataset to a popup window via parameters, using a dataset custom property in the popup's root container. (Or view parameter, in Perspective)
