Jump to content
  • Using .net System.Data.SqlClient module for database writeback in Spotfire® using IronPython


    This example provides a sample for database write back to Microsoft SQL Server (MSSQL) using .net System.Data.SqlClient module

    Table of Contents

    Introduction

    This example provides a sample for database write back to Microsoft SQL Server (MSSQL) using .net System.Data.SqlClient module

    Code Sample

    # Copyright © 2017. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    from Spotfire.Dxp.Data import DataType, DataValue
    
    from System import DateTime
    
    
    
    # Retrieve the current date, and store it in a variable.
    
    today = DateTime.Today
    
    # Perform some calculation by subtracting one(1) year from the current date.
    
    lastyear = today.AddYears(-1)
    
    # Convert DateTime objects to Spotfire types.
    
    sToday = DataValue.Create(DataType.Date,today.Date) 
    
    sLastYear = DataValue.Create(DataType.Date, lastyear.Date)
    
    # Set document properties with dates value, and not the wrapper object.
    
    Document.Properties["pStartDate"] = sLastYear.ValidValue
    
    Document.Properties["pEndDate"] = sToday.ValidValue
     

    See also

    References

    License:  TIBCO BSD-Style License

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...