Jump to content

creating two property control list boxes with the same document property to manipulate the tables in a visualization graph


Enkeled Kanaj

Recommended Posts

Hi,

Just wanted to share how I created two property control list boxes with the same document property to manipulate the tables in a visualization graph.

The script makes possible to switch the tables in the visualization when we go from one list box to the other list box.

The script:

from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Application.Visuals import HtmlTextArea
from Spotfire.Dxp.Data import DataTable


kpi = Document.Properties["KPINRCELLDU"]
vis = vis.As[Visualization]()

# Step 1: Define the names of the tables from which you want to list columns
table_name_1 = "DC_E_NR_NRCELLDU_RAW"  # Replace with the actual first table name
table_name_2 = "DC_E_ERBS_EUTRANCELLFDD_RAW (NR)"  # Replace with the actual second table name

# Step 2: Access the data tables by their names
data_table_1 = Document.Data.Tables[table_name_1]
data_table_2 = Document.Data.Tables[table_name_2]

# Step 3: Create lists to hold the column names for each table
column_names_1 = []
column_names_2 = []

# Step 4: Iterate over the columns in the first table and append their names to the first list
for column in data_table_1.Columns:
    column_names_1.append(column.Name)

# Step 5: Iterate over the columns in the second table and append their names to the second list
for column in data_table_2.Columns:
    column_names_2.append(column.Name)

if kpi in column_names_1:
  
 vis.Data.DataTableReference = Document.Data.Tables.Item["DC_E_NR_NRCELLDU_RAW"]
 vis.LineByAxis.Expression = "<[NR_NAME]>"    
 vis.ColorAxis.Expression = "<[NRCellDU]>"

elif kpi in column_names_2:
           
 vis.Data.DataTableReference = Document.Data.Tables.Item["DC_E_ERBS_EUTRANCELLFDD_RAW (NR)"]
 vis.LineByAxis.Expression = "<[ERBS]>"    
 vis.ColorAxis.Expression = "<[EUtranCellFDD]>"

 

image.thumb.png.29b8e30e737b35eb75f0204a1179b2f0.png

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...