简体   繁体   English

如何在Spotfire中使用IronPython获取列的外部名称?

[英]How can I get the externalname of a column using IronPython in Spotfire?

Currently I need to change the name of a column depending on specific criteria but to do that I'd like to refer to that column by its ExternalName rather than its name. 当前,我需要根据特定条件来更改列的名称,但是要做到这一点,我想通过它的ExternalName而不是它的名称来引用该列。

aColumn = Document.ActiveDataTableReference.Columns["I_id"].Name 

unfortunately this doesn't work. 不幸的是,这行不通。

aColumn = Document.ActiveDataTableReference.Columns["I_id"].ExternalName 

you're very close! 你很亲密! ExternalName isn't a property of the DataColumn object , which is, I suppose you've figured out, why your approach isn't working. ExternalName不是DataColumn对象的属性,我想您已经知道了为什么您的方法不起作用。

in fact, ExternalName is an item represented by the DataColumnProperties.DefaultProperties class . 实际上, ExternalName是由DataColumnProperties.DefaultProperties表示的项。 you would actually access this as if it were a custom-defined Column Property like so: 您实际上将访问它,就像它是一个自定义的Column属性一样:

col_ext_name = Document.ActiveDataTableReference.Columns["I_id"].Properties["ExternalName"]

print(col_ext_name)

>> index_id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM