David Katz Posted October 26, 2022 Share Posted October 26, 2022 How can use IronPython to create a new TagsColumn? Link to comment Share on other sites More sharing options...
Solution Gaia Paolini Posted October 27, 2022 Solution Share Posted October 27, 2022 You can create a new Tags Column from Iron Python, for example:# Copyright © 2022. TIBCO Software Inc. Licensed under TIBCO BSD-style license.from Spotfire.Dxp.Data import TagsColumnnewTagColumnName='newTag'cols = Document.Data.Tables["iris"].ColumnsnewTagColumn=cols.AddTagsColumn(newTagColumnName,['yes','no']);In this script I am creating a new Tags Column called 'newTag' in the 'iris' data table, with potential values of 'yes' and 'no'.The column will be created and you can visualize it just like any column. Also you can go up to the top menu and choose View >Tags to see it. It is initially all 'Untagged'.You can use Iron Python to set it as well. In the example below I am getting the marked rows as input and set the tag to 'yes' for those rows.# Copyright © 2022. TIBCO Software Inc. Licensed under TIBCO BSD-style license.from Spotfire.Dxp.Data import DataColumn, TagsColumn, IndexSet #Marked rows on the source tabledataSelection = Document.Data.Markings['Marking'] #the default marking schemedataTable = Document.Data.Tables['iris'] #my data tablemarkedRowSelection=dataSelection.GetSelection(dataTable) #Get handle to the required column and cast it to a tagcolumnmyTagColumn = dataTable.Columns.Item["newTag"].As[TagsColumn]() #Loop through the tag list and add the tagged/nontagged rowstags = myTagColumn.TagValuesfor t in tags: if t == 'yes': myTagColumn.Tag(t, markedRowSelection) 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