How to get column names of a dataset

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.

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,

Thanks for the help again! :smiley:

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

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

and

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. :laughing:

But we like your forum posts :wink:.

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. :laughing:[/quote]

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...

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...

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]