Labels

Change the datatable of a table visualization

1
2
3
4
5
6
7
from Spotfire.Dxp.Application.Visuals import VisualContent

tbl = currentTableVisualization.As[VisualContent]()
newtbl = Document.Data.Tables.Item[newDataTableName]
tbl.Data.DataTableReference=newtbl
tbl.AutoConfigure()
tbl.ApplyUserPreferences()

Input:
currentTableVisualization (Visualization): The table visualization that will have its datatable changed.
newDataTableName (String): The name of the new datatable.


4 comments:

  1. This change the data table listed but not update the #rows #marked #columns nor datatable name in below right corner of the screen. That information in below right corner is updated only when you click on actual data table. Is there any function to update that information automatically? Thanks beforehand.

    ReplyDelete
  2. Why do I get the error message ' line 3, in
    NameError: name 'currentTableVisualization' is not defined'?

    What do I need to do to get this thing working?

    ReplyDelete
  3. Why do I get the error message ' line 3, in
    NameError: name 'currentTableVisualization' is not defined'?

    What do I need to do to get this thing working?

    ReplyDelete
  4. Make sure that you have a script parameter that is called "currentTableVisualization"

    ReplyDelete