Rasheed Bello Posted August 12, 2019 Share Posted August 12, 2019 I am trying to set up my spotfire project such that i have a button in the text area that opens a text file or csv file with data and associates the spotfire columns with the imported data. Can you please help. R script , ironpython script Thanks Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted August 12, 2019 Share Posted August 12, 2019 To add a csv file as a data table, you can use the below script as reference from Spotfire.Dxp.Data import * from Spotfire.Dxp.Data.Import import * filePath=r"C:sample.csv" #specify any settings for the file settings= TextDataReaderSettings() dataSource=TextFileDataSource(filePath,settings) dataManager=Document.Data #datasource name and datasource to add table dataManager.Tables.Add("myNewDataTable",dataSource)https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/topic=html/T_Spotfire_Dxp_Data_DataTableCollection.htm https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/topic=html/T_Spotfire_Dxp_Data_Import_TextFileDataSource.htm https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/topic=html/T_Spotfire_Dxp_Data_Import_TextDataReaderSettings.htm Link to comment Share on other sites More sharing options...
Rasheed Bello Posted August 12, 2019 Author Share Posted August 12, 2019 thanks. It seems the colums in the source csv get imported as one column in spotfire. Howdo i get it to separate the original columns in the csv Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted August 13, 2019 Share Posted August 13, 2019 You need to specify the TextDataReaderSettings as needed. For example since this is a CSV file the separator would be a comma so you need to add the below code settings==TextDataReaderSettings() settings.Separator="," https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/topic=html/T_Spotfire_Dxp_Data_Import_TextDataReaderSettings.htm In a similar way you can configure the other available settings. You can refer to the above documentation for the available properties that can be configured Link to comment Share on other sites More sharing options...
Rasheed Bello Posted August 14, 2019 Author Share Posted August 14, 2019 Thanks. can you direct me to a document that breaks down the Spotfire property scripting. The document link above is not helpful. I mean a document with examples that breaks down the syntax like any other program. e.g. where do the Constructors go, Properties, Methods, Events. wWhat is the right syntax I cannot find any helpful document online. Spotfire.x.x.xxx.. from x.x.x. Link to comment Share on other sites More sharing options...
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