问题描述
当前,我需要根据特定条件来更改列的名称,但是要做到这一点,我想用它的ExternalName而不是它的名称来引用该列.
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.
aColumn = Document.ActiveDataTableReference.Columns["I_id"].Name
不幸的是,这不起作用.
unfortunately this doesn't work.
aColumn = Document.ActiveDataTableReference.Columns["I_id"].ExternalName
推荐答案
您非常亲密! ExternalName
不是 DataColumn
对象的属性. ,我想您已经弄清楚了为什么您的方法行不通.
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
是 DataColumnProperties.DefaultProperties
类一个>.您实际上会像访问自定义的 Column Property 一样访问它,如下所示:
in fact, ExternalName
is an item represented by the DataColumnProperties.DefaultProperties
class. you would actually access this as if it were a custom-defined Column Property like so:
col_ext_name = Document.ActiveDataTableReference.Columns["I_id"].Properties["ExternalName"]
print(col_ext_name)
>> index_id
这篇关于如何在Spotfire中使用IronPython获取列的外部名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!