Jump to content
  • How to set the custom date format for all Date columns in Spotfire® using IronPython scripting


    Code sample to set the custom data formate for all data columns in TIBCO Spotfire using IronPython scripting.

    Code sample

    # Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import *
    from Spotfire.Dxp.Data import DataManager, DataTable, DataType, DataTableSaveSettings, IndexSet, RowSelection
    from Spotfire.Dxp.Data.Formatters import *
    
    #Set the custom date format all DateTime columns will use
    customDateFormat = 'dd-MMM-yyyy'
    
    def formatDateTimeColumns():
    	formatter=DataType.DateTime.CreateLocalizedFormatter()
    	formatter.FormatString = customDateFormat
    
    
    	for table in Document.Data.Tables:
    		for column in table.Columns:
    			if column.Properties.DataType.ToString() == 'Date':
    				column.Properties.DataType  == DataType.Date
    				column.Properties.Formatter = formatter
    
    	print 'Completed formatDateTimeColumns()'
    	
    formatDateTimeColumns()
     

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...