Jump to content

Create DataType.Real Column value cursor


Ali Gounbarek

Recommended Posts

Hi, I want to know if there's a way to create a cursor of Data Type real. I already tried to create numeric cursor but it returns values of type System.Double which is not accepted by the ReplaceSpecificValueTransformation 

Here's My code:

from Spotfire.Dxp.Data import *
import System
from Spotfire.Dxp.Data.Transformations import *
table=Document.Data.Tables["Final_Test"]
dataTable = Document.Data.Tables["out"]
column=dataTable.Columns["Limits.Prod.Upper"]
id_column=dataTable.Columns["Name"]
#mutable= DataValueCursor.CreateTran(column)
cursor= DataValueCursor.CreateNumeric(column)

id_cursor = DataValueCursor.CreateFormatted(id_column)
#markings = Document.ActiveMarkingSelectionReference.GetSelection(dataTable)

data_operations = dataTable.GenerateSourceView().OperationsSupportingTransformations
last_data_operation=data_operations[len(data_operations)-1]
transformations = last_data_operation.GetTransformations()

col_signature = DataColumnSignature(column.Name,DataType.Real)
id_col_signature = DataColumnSignature(id_column.Name,DataType.String)

for row in dataTable.GetRows(cursor,id_cursor):
    value=cursor.CurrentValue
    DataType.TryConvertFromNumeric( value , DataType.Real)
    
    id_value=id_cursor.CurrentValue
    column=table.Columns[id_value]
    columnProperties=column.Properties
    property_value= columnProperties.GetProperty("Limits.Prod.Upper")
    transformations.Add(ReplaceSpecificValueTransformation(col_signature, value
     ,property_value,[id_col_signature], [id_value],True))

last_data_operation.ReplaceTransformations(transformations)

Link to comment
Share on other sites

No, because the data type of the column is Real and the error I get is that original value doesn't have the same type as the Column dataType which is Real. but I guess if I manage to convert from system.double to DataType.SingleReal, it would be helpful also.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...