Jump to content

How to get column names using ironpython

Marcio Souza

Recommended Posts

I got the following error running the suggested script.


Traceback (most recent call last):  File "<string>", line 7, in <module>TypeError: 'builtin_function_or_method' object is not subscriptableIronPython.Runtime.Exceptions.TypeErrorException: 'builtin_function_or_method' object is not subscriptable   at CallSite.Target(Closure , CallSite , Object , Object )

 Where line 7 is :  colNames.append[col.Name]Any idea

Link to comment
Share on other sites

  • 3 years later...

The below code is working fine. But I tried to save the column names into the document property. It won't save. Please suggest here!!

from Spotfire.Dxp.Data import *



for col in table.Columns:


Document.Properties['TestName'] == colNames

print colNames

Example Output:

['EEID', 'Full Name', 'Job Title', 'Department', 'Business Unit', 'Gender', 'Ethnicity', 'Age', 'Hire Date', 'Annual Salary', 'Bonus %', 'Country', 'City', 'Exit Date', 'AutoBinNumeric Test', 'Base64Decode']

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...