# Using dict comprehension to append data

**URL:** <https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225>\
**Category:** Ignition\
**Tags:** scripting, perspective, ignition81\
**Created:** [August 1, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225 "2023-08-01T15:00:23Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [August 1, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/21 "2023-08-01T16:17:00Z")

</div>

> [@bkarabinchak.psi](#):
>
> ```python
> import pprint
> ...
> pp = pprint.PrettyPrinter(depth=4)
> pp.pprint(mydict)
> 
> ```

bruh. i could kiss you. i won't, cuz that's gross, but the sentiment is there. 😃 i tried something similar earlier, but i was trying `from pprint import PrettyPrinter` and it crapped out. so i assumed it just didn't work and i was stuck with this bing-bong IDE and NO visualization tools... very happy to be wrong.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 1, 2023, 4:58pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/22 "2023-08-01T16:58:19Z")

</div>

crazy question here, and maybe I am missing something important, but if all you want is a single column of a dataset, then why not just use `system.dataset.filterColumns()`?

```auto
return system.dataset.filterColumns(value,['assetName'])

```

Or even better would be to use an expression binding.

> TIP: The `columnRearrange()` expression function can be used to filter dataset columns. It will only return the columns given in the expression in the order given.

```auto
columnRearrange({dataset},'assetName')

```

> [@ian.sebryk](#):
>
> AFAIK, the table parses a data object of key:value pairs; the key is the column name, the value is, well, the value. this should deliver what the table parser is looking for.

The table component will work with a dataset just fine.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [August 1, 2023, 5:09pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/23 "2023-08-01T17:09:30Z")

</div>

> [@lrose](#):
>
> why not just use `system.dataset.filterColumns()`?

...well 💩.

😆 time pressure. i _want_ to do nothing but read docs and experiment, but i _have_ to fix stuff _sooner_. thank you for this. i bow to your greater wisdom.

as for expressions, i'm just starting with that today... and it's not bending to my will just yet. of course i'm trying to do something obtuse and stupid with it, so that's likely why. 😛

---

<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, 5:10pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/24 "2023-08-01T17:10:10Z")

</div>

> [@lrose](#):
>
> Or even better would be to use an expression binding.

NB: don't sleep on this advice. Expressions are _way_ faster than scripting.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [August 1, 2023, 5:24pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/25 "2023-08-01T17:24:38Z")

</div>

> [@paul-griffith](#):
>
> NB: don't sleep on this advice. Expressions are _way_ faster than scripting.

that's why i'm digging in to them today. our server is just hammered with my predecessor's spaghetti monster code. it's a bit overwhelming at times. like: recursing a function to a blank baseline just to get a single user dataset. 😱 this kind of thing is just peppered throughout 25+ projects. so optimizing as i go is a critical add. so getting my head around the new syntax is... fun. i don't want to deploy it just to deploy it, if you know what i mean. it has to have purpose that makes sense in the context of the massive refactoring i'm doing. so knowing **when** to use it is just slightly more important as **how**. but to get there i have to start with **how**.

my brain is a wonderland... just not the sexy one from the song... 👙

---

<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, 5:37pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/26 "2023-08-01T17:37:30Z")

</div>

Ian, I think it is time for a serious talk with your boss(es).

> [@ian.sebryk](#):
>
> time pressure.

You been citing this for weeks. It is more than worn out. Your bosses' desire for the impossible won't magically make it happen.

The drama you are bringing as a result started as amusing, but is now just tiresome. Please reduce the whining.

> [@ian.sebryk](#):
>
> I HATE PYTHON 2...

This whining, too.

---

<div class="post-metadata">

**Author:** ![ian.sebryk](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ian.sebryk/32/49319_2.png) [@ian.sebryk](https://forum.inductiveautomation.com/u/ian.sebryk)\
**Post date:** [August 1, 2023, 5:38pm UTC](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225/27 "2023-08-01T17:38:32Z")

</div>

noted.

[Previous page](https://forum.inductiveautomation.com/t/using-dict-comprehension-to-append-data/77225.md?page=1)
