Exporting data to a excel with a Limit condition using Iron Python

Hi All,

I am trying to export the data to excel by specifying the limit condition in Iron Python script. When the Action Control - Button is clicked, then the data that satisfies the limit condition should be exported to excel. Below is the code  which is writing the complete data to excel even though the limit condition is specified.

Please assist me in limiting the data that is being exported to excel.

Thank you beforehand for the clarification.

#######################################################################

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers

from System.IO import File, Directory

from System.Collections.Generic import List

# directory

if not Directory.Exists("C:\Users\47586\Documents\Daily activities\POC"):

    Directory.CreateDirectory("C:\Users\47586\Documents\Daily activities\POC")

if Document.Data.Tables["Test"].Columns["Sales"] > 200:

               table = Document.ActiveDataTableReference

               names = ['Country_Name','Sales']

               allRows = Document.Data.AllRows.GetSelection(table).AsIndexSet()

               writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter)

# columns

               stream = File.OpenWrite("C:\Users\47586\Documents\Daily activities\POC\Filename.xls")

               

               allColumnNames = List[str]()

               writer.Write(stream, table, allRows,names)

               stream.Close()

               stream.Dispose()

#######################################################################

 

Thanks

San

(1) Answer

Login