简体   繁体   中英

How to use document properties as variables in an IronPython Script to Change Column Names in Spotfire

I am aiming to write a script (that ill run with a Action Item Button) to take use a Drop Down Property Control to select a column in my Data Table, and then change the name to whatever I type in an Input Field Property Control.

My script is simple and below and works when I type the values of the column i'd like to rename (Currently "TWO") and the new name i'd like to use "THREE"

Application.Document.Data.Tables['DataTable'].Columns['TWO'].Name='THREE'

What I would like to do is using a document property I created OldName.Property in place of 'TWO" and another document property "NewName.Property" in the place of three. I thought I had set up the script paramters correctly but I guess I haven't because they aren't working.

我的简单设置

脚本和脚本参数

You are using quotes (and in one case square brackets) around the property names TWO and THREE.

This worked for me:

Application.Document.Data.Tables['yourtable'].Columns[TWO].Name=THREE

where 'yourtable' is a literal string (your table name). TWO and THREE are the input parameters. If you set them to type Property you can simply select a document property and click on it to set each of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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