Christopher Ciccone Posted December 4, 2019 Posted December 4, 2019 Is it possible to write a script that would write the content presented in a cross table to a data table so that the data could be used in other visualizations
Christopher Ciccone Posted December 5, 2019 Author Posted December 5, 2019 https://community.tibco.com/wiki/how-export-tablecross-table-visualization-data-sbdf-file-spotfire-library-using-tibco-spotfirer Was able to do what I needed after reading through some other users comments in the Chatter feed of this page linked above. Following section of code will copy a CrossTable and save it to a Data Table, overwriting upon execution. from System.IO import * from Spotfire.Dxp.Application.Visuals import VisualContent from System import Array,Guid,String,Object from Spotfire.Dxp.Data.Import import * from Spotfire.Dxp.Framework.Library import LibraryManager, LibraryItemRetrievalOption, LibraryItemType, LibraryItem vc=Visuals.As[VisualContent]() #Visuals = Script parameter for Table/Cross Table visualization memStream = MemoryStream(); sWriter = StreamWriter(memStream); #Exporting the data to Memory Stream vc.ExportText(sWriter); #exports data in tab separated text sReader = StreamReader(memStream); memStream.Seek(0, SeekOrigin.Begin); textDataSource = TextFileDataSource(memStream); tables = Document.Data.Tables["FakeTable"] # Create dummy exportdata datatable and have the rows in visualization be exported to that table tables.ReplaceData(textDataSource)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now