Raoul Blankertz Posted July 6, 2016 Share Posted July 6, 2016 Hi all, Is there a way to check or uncheck certain markings in "limit data using markings" in a visualization through a python script Thanks Link to comment Share on other sites More sharing options...
Sean Riley Posted July 6, 2016 Share Posted July 6, 2016 There are a number of ways to mark with IronPython, depending on what you are interacting with in the analysis file. The DataManager owns the Marking object. It controls the markings them selves (add/remove): https://docs.tibco.com/pub/doc_remote/spotfire/7.0.0/doc/api/topic=html... https://docs.tibco.com/pub/doc_remote/spotfire/7.0.0/doc/api/topic=html... Here is an example marking on a Bar Chart: from Spotfire.Dxp.Application.Visuals import * from Spotfire.Dxp.Data import DataPropertyClass p=Document.Data.Properties.GetProperty(DataPropertyClass.Document,"mymarkings").Value marking = Document.Data.Markings[p] for page in Application.Document.Pages: for vis in page.Visuals: if vis.Title == "Bar Chart": vi = vis.As[barChart]() m=vi.Data.MarkingReference vi.Data.MarkingReference=marking And you can clear all markings with something like: #Import required libraries from Spotfire.Dxp.Data import * from Spotfire.Dxp.Application.Filters import * def resetMarking(): # Loop through each data table for dataTable in Document.Data.Tables: # Navigate through each marking in a given data table for marking in Document.Data.Markings: # Unmark the selection rows = RowSelection(IndexSet(dataTable.RowCount, False)) marking.SetSelection(rows, dataTable) # Call the function resetMarking() Link to comment Share on other sites More sharing options...
Andrew Berridge Posted July 6, 2016 Share Posted July 6, 2016 Yes indeed it is possible: from Spotfire.Dxp import Data from Spotfire.Dxp.Application.Visuals import * for filtering in vis.As[VisualContent]().Data.Filterings: print filtering.Name vis.As[VisualContent]().Data.Filterings.Remove(filtering) vis.As[VisualContent]().Data.Filterings.Add(Document.Data.Markings["Marking"])Note that this will also affect filtering selections. Each of the filtering objects will either be a DataMarkingSelection or a DataFilteringSelection object. You can get the type of the filtering like: print filtering.GetType() Hope this helps! Andrew (TIBCO Data Science) Link to comment Share on other sites More sharing options...
Raoul Blankertz Posted July 7, 2016 Author Share Posted July 7, 2016 Thanks a lot. This was what I am looking for. Who could know that they hide the Markings in the Filters ;-) Link to comment Share on other sites More sharing options...
Methodios Typou Posted September 8, 2020 Share Posted September 8, 2020 This has worked very well for me too, thank you. I can't figure out though, how to also deactivate the marking via ironpython script, anyone can help I get that this "vis.As[VisualContent]().Data.Filterings.Remove(Document.Data.Markings["Marking"])" will deactivate the marking just as .Add activates it, what I can't figure out is how to apply a conditional logic, i.e. how to check if "Marking" is active or not currently, so I can subsequently apply either .Add or .Remove. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now