Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Display filter group for selected data table only and corresponding table visualization using IronPython


    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Application.Visuals import *
    from System.Collections.Generic import List
    from Spotfire.Dxp.Data import DataPropertyClass
    from Spotfire.Dxp.Application.Filters import *
    from Spotfire.Dxp.Application import PanelTypeIdentifiers
    
    
    selection = Document.Properties['DataTables']
    
    # print selection
    
    viz = viz.As[Visualization]()
    
    t1 = Document.Data.Tables.Item['Table Name 1']
    t2 = Document.Data.Tables.Item['Table Name 2']
    
    
    if selection == 'Table Name 1':
    	viz.Data.DataTableReference = t1
    	viz.TableColumns.Clear()  #Clear first to prevent duplicate error
    	for i in t1.Columns:
    		viz.TableColumns.Add(i)
    	for panel in Document.ActivePageReference.Panels:
    		if panel.TypeId == PanelTypeIdentifiers.FilterPanel:
    			for group in panel.TableGroups:
    				if group.Name == t1:
    						group.Visible = True
    				if group.Name == t2:
    						group.Visible = False
    						
    if selection == 'Table Name 2':
    	viz.Data.DataTableReference = t2
    	viz.TableColumns.Clear()  #Clear first to prevent duplicate error
    	for i in t2.Columns:
    		viz.TableColumns.Add(i)
    	for panel in Document.ActivePageReference.Panels:
    		if panel.TypeId == PanelTypeIdentifiers.FilterPanel:
    			for group in panel.TableGroups:
    				if group.Name == t1:
    						group.Visible = False
    				if group.Name == t2:
    						group.Visible = True from Spotfire.Dxp.Data import * from Spotfire.Dxp.Application.Visuals import * from System.Collections.Generic import List from Spotfire.Dxp.Data import DataPropertyClass from Spotfire.Dxp.Application.Filters import * from Spotfire.Dxp.Application import PanelTypeIdentifiers   selection = Document.Properties['DataTables']  # print selection  viz = viz.As[Visualization]()  t1 = Document.Data.Tables.Item['Table Name 1'] t2 = Document.Data.Tables.Item['Table Name 2']   if selection == 'Table Name 1': 	viz.Data.DataTableReference = t1 	viz.TableColumns.Clear()  #Clear first to prevent duplicate error 	for i in t1.Columns: 		viz.TableColumns.Add(i) 	for panel in Document.ActivePageReference.Panels: 		if panel.TypeId == PanelTypeIdentifiers.FilterPanel: 			for group in panel.TableGroups: 				if group.Name == t1: 						group.Visible = True 				if group.Name == t2: 						group.Visible = False 						 if selection == 'Table Name 2': 	viz.Data.DataTableReference = t2 	viz.TableColumns.Clear()  #Clear first to prevent duplicate error 	for i in t2.Columns: 		viz.TableColumns.Add(i) 	for panel in Document.ActivePageReference.Panels: 		if panel.TypeId == PanelTypeIdentifiers.FilterPanel: 			for group in panel.TableGroups: 				if group.Name == t1: 						group.Visible = False 				if group.Name == t2: 						group.Visible = True

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...