Products | Versions |
---|---|
Spotfire Analyst | All Versions |
Assuming you have a data source which only contains the latest data (for example, last week's data) but does not retain the historical older data, this is one method to insert that data regularly to a table, continually appending the new rows to the existing data.
In this example, TableA has the initial data and is embedded in the analysis file. TableB is based on an Information Link which contains only last week's data (no earlier historical data). If "Insert > Row" is used to add data from TableB to TableA, it will not retain the data from the prior week, and will only contain most recent week's worth of data. In order to capture that data, you can append all the rows of TableB to TableA before "B" is refreshed with new data and use Automation Services to execute an IronPython script which inserts rows from TableB to the embedded TableA according to the required schedule (weekly in this example).
from Spotfire.Dxp.Data import AddRowsSettings from Spotfire.Dxp.Data.Import import DataTableDataSource #Source Data Table sourceDataTable=Document.Data.Tables["TableB"] dataSource=DataTableDataSource(Document.Data.Tables["TableB"]) #Append rows to new data table destinationDataTable=Document.Data.Tables["TableA"] rowsettings=AddRowsSettings(destinationDataTable,dataSource) destinationDataTable.AddRows(dataSource,rowsettings) sourceDataTable.Refresh()4) Configure this IronPython script to execute on change in value of a document property. For example, name the document property "trigger" with default date time value of "1/1/1900 00:00" (Note: If you want to see exact time like exact minutes, seconds etc. change the document property data type to string. If the document property data type is datetime you will see the value getting updated as 3/21/2019 3:00:00 PM instead of 3/21/2019 3:25:20 PM)
trigger="{date} {time}" ;-> "Save Analysis to Library"