Skip to main content
RSS feed Subscribe to feed


Skip Navigation LinksHome  Extending the Spotfire Platform  Creating Extensions to the Spotfire Platform  Creating a Transformation  Transformation: Returning a Column of Undefined Data Type

©Spotfire 2011

Transformation: Returning a Column of Undefined Data Type

This reader adds a new column to the data set which contains a Color object, a data type that is not a supported in Spotfire. The example only shows the reader.

private class ColorTransformationReader : CustomDataRowReader
    private DataRowReader input;
    private List<DataRowReaderColumn> columns;
    private MutableValueCursor<object> colorCursor;
    private Random random;

    public ColorTransformationReader(DataRowReader input)
        this.random = new Random();
        this.input = input;
        this.columns = new List<DataRowReaderColumn>();
        this.colorCursor = 

            new DataRowReaderColumn(
                new DataColumnProperties(),

    protected override IEnumerable<DataRowReaderColumn> GetColumnsCore()
        return this.columns;

    protected override ResultProperties GetResultPropertiesCore()
        return new ResultProperties();

    protected override bool MoveNextCore()
        if (!this.input.MoveNext())
            return false;

        Color c = random.NextDouble() > 0.5 ? 
					Color.DarkMagenta : Color.ForestGreen;

        colorCursor.MutableDataValue.Value = c;

        return true;

    protected override void ResetCore()