Event on Marking Reset from KPI Chart

The below script is designed to populate a property with a unique value from marked rows in a KPI chart.  This is working fine, however if a user selects the blank space in a visualization and resets the marking, this remains populated.  Is there a way to alter the code to reference that "reset marking" click in the visualization or soemthing similar so that when the marking is reset the value goes back to the default?  Otherwise, can i disable this click so the user must click a  button to reset markings where I can also set the button to reset the property?

 

from Spotfire.Dxp.Data import *  
from System import String,Object  

array = []
uniqueArray = []
val  = 'All'
Property1= 'All'
valueCheck = ''
    
#retrieve rows
markedRows = Document.Data.Markings["Marking1"].GetSelection(Document.Data.Tables["table1"]).AsIndexSet()
valueCheck = markedRows.Count

#cursor
cursor = DataValueCursor.CreateFormatted(Document.Data.Tables["Table1"].Columns["Column1"])

#loop cursor
if valueCheck != '0':
   for row in Document.Data.Tables["Table1"].GetRows(markedRows,cursor): 
      val = cursor.CurrentValue
      array.append(val)
      uniqueArray = set(array)
elif valueCheck == '0':
   Document.Properties["Property1"] = 'All'

#GetCount of rows in filter selection
Document.Properties["valueCheck"] = valueCheck

#pass to variable and to
Document.Properties["Property1"] = ", ".join(uniqueArray)

 

(1) Answer

Login