Click or drag to resize
CalculationWorks Logo
Using Setters to Update Computed Columns
Redirecting updates on computed columns

The example shows how a computed column can be made writable by redirecting input.

Use BCF Editor to add PointFunction and PointSetter to a column.

The example is simplified and will only work if X and Y are on the same row like the computed point.

public class PointFunction : BcfFunctionBase<Point> {

    public int X { get; set; }

    public int Y { get; set; }

    public override Point Compute() { return new Point(X, Y); }
public class PointSetter : BcfColumnValueSetter {

    public override void SetValue(BcfCell cell, object value) {
        var point = (Point) value;
        var xColumn = cell.Column.Function.Parameters.First(p => p.Name == "X").SourceColumn;
        var yColumn = cell.Column.Function.Parameters.First(p => p.Name == "Y").SourceColumn;
        cell.Row[xColumn].Value = point.X;
        cell.Row[yColumn].Value = point.Y;
See Also