Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Replace specific values of a Data Table column in Spotfire® using IronPython

    Sample code to replace values in a column of a Data Table


    This example provides a sample code to replace values in a column of a Data Table

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Data.Transformations import *
    dataOperation = dataTable.GenerateSourceView().OperationsSupportingTransformations[0];
    transformations = dataOperation.GetTransformations();
    #clear all transformations on this dataTable if needed
    #Replace Values Transformation
    column = DataColumnSignature("Year",DataType.Integer);
    t=transformations.Add(ReplaceValuesTransformation(column, 0, 2018))
    #Replace specific value Transformation
    column = DataColumnSignature("Severity",DataType.String);
    row_id_col_values = [7]
    transformations.Add(ReplaceSpecificValueTransformation(column, "Med","Medium",row_id_cols, row_id_col_values,True))
    #dataTable - Table script parameter in which the value needs to be replaced


    License:  TIBCO BSD-Style License

    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...