Export data tables (visualizations) by a dynamic Command Button

How to export any data table on your report with Iron Python? (yes, even tables with data limitation)

Note this tool will allow you to:

Export any data table on the report as data visualization. It means, if you decide to limite the data and/or to show only some columns of the data table, the file will be export as it.
Choose the export folder on your computer by a document property (“C:\\”…)
Customize the name of the export file by a document property (“_2017”, “_ByMe”…)

from System.IO import Path, File, StreamWriter
from Spotfire.Dxp.Application.Visuals import TablePlot
from System.IO import Path, File, StreamWriter
from Spotfire.Dxp.Application.Visuals import TablePlot
from Spotfire.Dxp.Data import DataPropertyClass
from Spotfire.Dxp.Data import DataType

for d in Document.Data.Properties.GetProperties(0):
if d.IsUserVisible and d.Name == “ReportingDate”: x = d.Value

for f in Document.Data.Properties.GetProperties(0):
if f.IsUserVisible and f.Name == “ReportingFolder”: y = f.Value

tempFilename = y + “\\sp500overview_” + x + “.csv”
writer = StreamWriter(tempFilename)
Viz1.As[TablePlot]().ExportText(writer)

tempFilename = y + “\\sp500price_” + x + “.csv”
writer = StreamWriter(tempFilename)
Viz2.As[TablePlot]().ExportText(writer)

tempFilename = y + “\\sp500marketvalue_” + x + “.csv”
writer = StreamWriter(tempFilename)
Viz3.As[TablePlot]().ExportText(writer)

You must pay attention to select your input for the selected script as below (“Viz1”, “Viz2” and “Viz3”).

The objective is to give to each export the data visualization concerned : Viz3.As[TablePlot] is concerning the Viz3 selected as input. Then, as you can see on the script above, x and y are defined as the ReportingDate and ReportingFolder’ document properties. Both can be modify directly in the analysis by input fields (HTML).

Important information: This tool works only in Spotfire Desktop, not in the web version!

Leave a Reply

Your email address will not be published. Required fields are marked *

Download Details

Export data tables (visualizations) by a dynamic Command Button

1 sales

Cart

  • Your cart is empty.
Posted In:  
Tags:

Copyright 2017

Baptiste