Export Marked Data

Hi everyone,

I'm marking data on a map that's based on one table called AC_PROPERTY.

I want to export the rows of data from another table called AC_DAILY to .csv that have a matching field to a field in the marked row of the AC_PROPERTY table...below is as far as I could get.  Do you guys have any thoughts?  Thanks

from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers
from System.IO import File
from System.Collections.Generic import List
from Spotfire.Dxp.Data import *

# Create a cursor for the table column to get the values from.
# Add a reference to the data table in the script.
ACPROPtable = Document.Data.Tables["AC_PROPERTY"]
ACDAILYtable = Document.Data.Tables["AC_DAILY"]

writer = Document.Data.CreateDataWriter(DataWriterTypeIdentifiers.ExcelXlsDataWriter)
table = ACDAILYtable #Document.ActiveDataTableReference #OR pass the DataTable as parameter
filtered = Document.ActiveFilteringSelectionReference.GetSelection(ACPROPtable).AsIndexSet() #OR pass the filter
marked = Document.ActiveMarkingSelectionReference.GetSelection(ACPROPtable)
stream = File.OpenWrite("C:\Project 001\AC_TEST.csv")
names = []
for col in table.Columns: 

for row in table.Rows:
  if row.<FieldName> = String in Column from Marked Data
  add the row to the table

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


(1) Answer