# How to get column names of a dataset

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407>\
**Category:** Archived Topics\
**Created:** [November 14, 2007, 6:24pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407 "2007-11-14T18:24:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MickeyBob](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@MickeyBob](https://forum.inductiveautomation.com/u/MickeyBob)\
**Post date:** [November 14, 2007, 6:24pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/1 "2007-11-14T18:24:39Z")

</div>

Is there a way to get the column names of a dataset through scripting? For example, I would like to determine what columns comprise a chart component’s dataset.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [November 14, 2007, 7:04pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/2 "2007-11-14T19:04:25Z")

</div>

Sure. Suppose you chart’s dataset was named “Data”

Put this code on a button next to your chart and it will print out to the console the column names of the Data dataset:

`chart = event.source.parent.getComponent("Chart")
columns = chart.Data.columnNames
for column in columns:
	print column`

Hope this helps,

---

<div class="post-metadata">

**Author:** ![MickeyBob](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@MickeyBob](https://forum.inductiveautomation.com/u/MickeyBob)\
**Post date:** [November 14, 2007, 8:03pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/3 "2007-11-14T20:03:56Z")

</div>

Thanks for the help again! 😃

I’ve also found out from tech support that there are alternative methods/attributes. For example, one can also do the following:

```auto
columns = chart.Data.getColumnNames()
for column in columns:
    print column
```

and

```auto
columncnt = chart.Data.getColumnCount()
for index in range(0, columncnt):
    print chart.Data.getColumnName(index)
```

It would be really nice if there were some documentation available that would explicitly list the attributes of the various classes/components.

I also found out that there are implicit ‘get’ methods for every property that shows up in the property window when a component is selected. For example, there is a ‘.getPens()’ method for the Easy Chart component.

I can’t say that I have read the help file exhaustively so it might already be in there, but it would be nice if this were explained in the user’s manual. That might cut down on the number of questions you get from me. 😆

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [November 15, 2007, 4:10am UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/4 "2007-11-15T04:10:44Z")

</div>

But we like your forum posts 😉.

Each component has properties and functions listed under the technical reference-\>components section. I don’t think the get methods aren’t listed. You’re also right that there isn’t yet a good Jython reference to dataSet functions. I’ll look into this.

I will suggest that we open a section of the forum for documentation questions/suggestions. I learned that our “Navigation” section is out of date from another post today. I think that keeping our docs current is important, even though it often feels like few of our users take the time to read them.

[quote=“MickeyBob”]  
It would be really nice if there were some documentation available that would explicitly list the attributes of the various classes/components.

I also found out that there are implicit ‘get’ methods for every property that shows up in the property window when a component is selected. For example, there is a ‘.getPens()’ method for the Easy Chart component.

I can’t say that I have read the help file exhaustively so it might already be in there, but it would be nice if this were explained in the user’s manual. That might cut down on the number of questions you get from me. 😆[/quote]

---

<div class="post-metadata">

**Author:** ![MickeyBob](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@MickeyBob](https://forum.inductiveautomation.com/u/MickeyBob)\
**Post date:** [November 15, 2007, 4:30pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/5 "2007-11-15T16:30:00Z")

</div>

> [@](#):
>
> Each component has properties and functions listed under the technical reference-\>components section.

I knew about these. It's the .getColumnNames() and .ColumnNames attributes that I would love to learn more about.

I understand the dilemma regarding documentation. You probably have limited resources and want to put the work where it's most appreciated.

The quality of documentation is very good. I just think it needs to be a little more comprehensive.

Well, that's my 2 cents worth...

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [November 15, 2007, 4:59pm UTC](https://forum.inductiveautomation.com/t/how-to-get-column-names-of-a-dataset/407/6 "2007-11-15T16:59:25Z")

</div>

I thought you'd figured that out based on your post. A more comprehensive reference is certainly useful - especially for us. I just need to be more diligent in noting and updating docs as I see changes/deficiencies. I'd like to include more examples, too. Then again, I'd also like to create how-tos and video tutorials...

> [@MickeyBob](#):
>
> [quote]Each component has properties and functions listed under the technical reference-\>components section.

I knew about these. It's the .getColumnNames() and .ColumnNames attributes that I would love to learn more about.

I understand the dilemma regarding documentation. You probably have limited resources and want to put the work where it's most appreciated.

The quality of documentation is very good. I just think it needs to be a little more comprehensive.

Well, that's my 2 cents worth...[/quote]
