Jump to content

Deleting Added Columns via IronPython


Rick Phelan 2

Recommended Posts

I have created added columns via IronPython and it works well. When I try to delete the columns via IronPython it seems to work, but when I look at the data canvas it still shows the added columns and one has to manually delete them. Is there a way to delete the added column object in data canvas in IronPython Below is the code I am using to delete the columns by name. I will attach a screen shot showing the added columns in data canvas even though they do not exist in the table anymore.

 

"from Spotfire.Dxp.Data import *

from System.Collections.Generic import List

dt = Document.Data.Tables["Sheet"]

columnsToDelete = List[DataColumn]()

for column in dt.Columns:

if column.Name == 'Cum_Prod':

columnsToDelete.Add(column)

if columnsToDelete.Count != 0:

dt.Columns.Remove(columnsToDelete)"

Link to comment
Share on other sites

  • 3 years later...

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...