Jump to content
  • How to Replace a Transformation in a DataTable in Spotfire® Using IronPython Scripting


    This article contains an IronPython code sample for how to replace a transformation in a DataTable in Spotfire®

    Introduction

    The Data Table Source View API allows for reading information on the different operations and transformations that are performed to construct a data table in an analysis, what is referred to as the data table source view. It is also possible to modify individual operations and transformations. Below is a sample script to replace a transformation.

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Data.Transformations import *
    from Spotfire.Dxp.Data.DataOperations import *
    from System.Collections.Generic import List
    
    table=Document.ActiveDataTableReference
    sourceview=table.GenerateSourceView()
    
    operation= None
    #get DataTransformations
    for op in sourceview.GetAllOperations[DataTransformationsOperation]():
    	print op.DisplayName
    	operation=op
    
    #create new ReplaceValueTransformation
    
    newtrans=List[DataTransformation]()
    column = DataColumnSignature("Name",DataType.String);
    t=ReplaceValuesTransformation(column, "value1", "value2")
    newtrans.Add(t)
    
    operation.ReplaceTransformations(newtrans)
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...