CalculationSettings Class TIBCO Spotfire 7.0 API Reference
Base class for calculation settings. Holds the input to a calculation and uses it to determine when the calculation needs to be rerun, invalidated etc. This class must be extended to implement a specialized settings 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 CalculationSettings
        Spotfire.Dxp.Application.Calculations.DataRelationships DataRelationshipsCalculationSettings

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

[SerializableAttribute]
[PersistenceVersionAttribute(3, 0)]
public abstract class CalculationSettings : DocumentNode
Remarks

Adding the input as dependencies allows the framework to ask for a recalculation/invalidation when they change. In addition it will detect when they disappear due to the user deleting vital columns and avoid recalculation until new ones are set up. The deriving class can ask this base class for default result types such as columns or tables by using CalculationDependencyIdentifier objects created in the nested CalculationSettings CalculationDependencyIdentifiers 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 show a sample implementation of this class.
    internal class MyCalculationSettings : CalculationSettings
    {
    #region Classes for property names

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

    #endregion // Classes for property names 

    #region Classes for calculation dependency identifiers

    public new abstract class CalculationDependencyIdentifiers 
        : CalculationSettings.CalculationDependencyIdentifiers
    {
        internal static readonly CalculationDependencyIdentifier XColumns = CreateIdentifier("XColumns");

        internal static readonly CalculationDependencyIdentifier YColumns = CreateIdentifier("YColumns");

        internal static readonly CalculationDependencyIdentifier DataFilteringSelection = CreateIdentifier("DataFilteringSelection"); 
    }

    #endregion 

    #region Properties

    public override CalculationUpdateBehavior UpdateBehavior
    {
        get { return CalculationUpdateBehavior.Invalidate; }
    }

    public DataTable XColumnsSourceDataTable
    {
        get
        {
            DataColumnCalculationDependencyCollection dep = GetColumnDependencies(CalculationDependencyIdentifiers.XColumns);
            if (dep != null)
            {
                //unlike asking the columns for their ancestor table this will always work even if the user has deleted all columns 
                //in the table and is thus preferable 
                return dep.DataTable;
            }
            return null;            
        }
    }

    public IEnumerable<DataColumn> XColumns
    {
        get 
        {     
            DataColumnCalculationDependencyCollection dep =  GetColumnDependencies(CalculationDependencyIdentifiers.XColumns);
            if (dep != null)
            {
                return dep.Columns;
            }
            return new List<DataColumn>();
        }
        set 
        { 
            AddDependency(CalculationDependencyIdentifiers.XColumns, value);
        }
    }

    public IEnumerable<DataColumn> YColumns
    {
        get
        {
            DataColumnCalculationDependencyCollection dep = GetColumnDependencies(CalculationDependencyIdentifiers.YColumns);
            if (dep != null)
            {
                return dep.Columns;
            }
            return new List<DataColumn>();
        }
        set 
        { 
            AddDependency(CalculationDependencyIdentifiers.YColumns, value);
        }
    }

    //the steps for a dependency on marking are exactly the same 
    public DataFilteringSelection DataFilteringSelection
    {
         get
         {
             DataSelectionCalculationDependency dep = GetDataSelectionDependency(CalculationDependencyIdentifiers.DataFilteringSelection);
             if(dep!=null)
             {
                 return dep.DataSelection;
             }
             return null;
         }
         set
         {
             AddDependency(CalculationDependencyIdentifiers.DataFilteringSelection, value);
         }
    }

    #endregion 

    #region Construction

    public MyCalculationSettings()
    {
    }

    #endregion 

    #region ISerializable Members

    protected MyCalculationSettings(SerializationInfo info, StreamingContext context)
       : base(info, context)
    {
    }

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

    #endregion 
}
Version Information

Supported in: 7.0, 6.5, 6.0, 5.5, 5.0
See Also