用另一个临时表更新Spotfire表
我有一个表格,叫做 update_table_df,里面有三个列:WELL(井)、OIL(油)、GAS(气)。这个表格记录了三个井的信息,分别是 A、B 和 C。
我创建了一个临时表,里面是井 C 的新信息。
from Spotfire.Dxp.Data import DataTable
# Define the names of the tables
table_a_name = "test_output_df"
temp_table_name = "temp"
# Get references to the tables
table_a = Document.Data.Tables[table_a_name]
temp_table = Document.Data.Tables[temp_table_name]
# Extract the unique "WELL" value from the first row of TEMP table
well_value_to_delete = temp_table.Columns["WELL"][0].Value
# Delete rows in TABLE A where "WELL" matches the value from TEMP table
rows_to_delete = [row for row in table_a.GetRows() if row["WELL"] == well_value_to_delete]
for row in rows_to_delete:
table_a.RemoveRows([row.Id])
# Append rows from TEMP table to TABLE A
for temp_row in temp_table.GetRows():
table_a.AddRow(temp_row)
# Refresh the visualization to reflect the changes
Document.ActivePageReference.Visuals.Refresh()
当我尝试从临时表的第一行提取唯一的井信息时,出现了一个错误:“TypeError: 'DataColumn' object is not subscriptable”。有没有人能帮我解决这个问题?
0 个回答
暂无回答