CalculationResults Class TIBCO Spotfire 6.0 API Reference
Abstract base class for calculation results. After a calculation has been executed the results can be found here. This class must be extended to implement a specialized results class that is suited for a concrete calculations implementation.
Inheritance Hierarchy

System Object
  Spotfire.Dxp.Framework.DocumentModel Node
    Spotfire.Dxp.Framework.DocumentModel DocumentNode
      Spotfire.Dxp.Application.Calculations CalculationResults
        Spotfire.Dxp.Application.Calculations.DataRelationships DataRelationshipsCalculationResults

Namespace: Spotfire.Dxp.Application.Calculations
Assembly: Spotfire.Dxp.Application (in Spotfire.Dxp.Application.dll) Version: 13.19.7018.3940 (13.19.7018.3940)
Syntax

[SerializableAttribute]
[PersistenceVersionAttribute(2, 0)]
public abstract class CalculationResults : DocumentNode
Remarks

The deriving class can ask this base class for default result types such as columns or tables by using CalculationResultsIdentifier objects created in the nested CalculationResults CalculationResultsIdentifiers class. These should then be exposed as normal properties in the deriving class so user of the implementation calculation doesn't have to know anything about identifiers etc.
Examples

This example shows the pattern for a deriving class exposing the results.
 public class MyCalculationResults : CalculationResults
{     
    #region Classes for property names

    public new abstract class PropertyNames : CalculationResults.PropertyNames
    {
        //empty
    }

    #endregion // Classes for property names 

    #region Classes for result identifiers

    public new abstract class CalculationResultsIdentifiers : CalculationResults.CalculationResultsIdentifiers
    {
         public static readonly CalculationResultsIdentifier MySpecialColumn = CreateIdentifier("MySpecialColumn");

         public static readonly CalculationResultsIdentifier MyLumpedTogetherColumns = CreateIdentifier("MyLumpedTogetherColumns");

         public static readonly CalculationResultsIdentifier MyNewTable = CreateIdentifier("MyNewTable");
    }

    #endregion 

    #region Public properties

    public DataColumn MySpecialColumn
    {
        get { 
            ColumnsCalculationResult res = GetColumnsResult(CalculationResultsIdentifiers.MySpecialColumn);
            //check that the user hasn't removed the table or the column 
            if (res == null || res.Columns.Count == 0)
            {
                return null;
            }
            return res.Columns[0];
        }
    }

    public IEnumerable<DataColumn> MyLumpedTogetherColumns
    {
        get 
        {
            ColumnsCalculationResult res = GetColumnsResult(CalculationResultsIdentifiers.MyLumpedTogetherColumns);
            if (res == null)
            {
                return null;
            }
            return res.Columns;
        }
    }

    public DataTable MyNewTable
    {
        get
        {
             ColumnsCalculationResult res = GetColumnsResult(CalculationResultsIdentifiers.MyNewTable);
             if (res == null)
             {
                 return null;
             }
             //this will always work even if all the columns in the table are deleted. Thus it is preferable to asking a resultcolumn for 
             //its ancestor column 
             return res.DataTable;
        }
    }

    #endregion // Public properties 

    #region Construction

    public MyCalculationResults()
    {
    }

    #endregion // Construction        

    #region ISerializable Members

    protected MyCalculationResults(SerializationInfo info, StreamingContext context)
        : base(info, context)
    {

    }

    protected override void GetObjectData(SerializationInfo info, StreamingContext context)
    {
        base.GetObjectData(info, context);
    }
    #endregion
 }
See Also