2
votes

I am trying to put filter on datatable name in dropdown, for which i need list of datatable in my analysis page. How to list down all datatables name so that i can select them in drop down and then show data specific to data table in tabular view.

import Spotfire.Dxp.Data.DataTable
from Spotfire.Dxp.Data import *

dataTable = Document.Data.Tables['dataTableName']

for column in dataTable.Columns:
    print column

Above gives me column for the data table name i supply, but what i need is list of datatables and then put them into dropdown filter to select specific data table.

3

3 Answers

1
votes
from Spotfire.Dxp.Data import *

for x in Document.Data.Tables:
    print x.Name

You can then assign the values that get kicked out of the loop to a document property, and use that in a drop down/to set another document property if needed.

1
votes

You don't even need to import any libraries...

for dtable in Document.Data.Tables:
    print dtable.Name
1
votes

You can feel free to print as you like, this is the base code that you will require to map columns for all tables.

for tables in Document.Data.Tables:
tablename = tables.Name
for column in DataTable.Columns:
    externalname = column.Properties["ExternalName"]
    internalname = column.Name