Ali Gounbarek Posted April 4 Share Posted April 4 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 More sharing options...
Gaia Paolini Posted April 8 Share Posted April 8 maybe SingleReal? Link to comment Share on other sites More sharing options...
Ali Gounbarek Posted April 8 Author Share Posted April 8 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 More sharing options...
Gaia Paolini Posted April 8 Share Posted April 8 What is the original Spotfire data type of the column you are replacing? Link to comment Share on other sites More sharing options...
Gaia Paolini Posted April 8 Share Posted April 8 (edited) also can you please clarify what the script does? It seems to work off two tables (out and Final_Test). If possible please include a sample of the two tables. Edited April 8 by Gaia Paolini Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now