Skip to content
CanopyX

Dataset compare

Two snapshots matched by key: what was added, removed and changed, with before and after in each cell.

CanopyDatasetComparerTwo inventory snapshots, matched by keyDocumentation for the dataset compare

1 demo

Inventory changes Open this demo full screen

Two snapshots matched by key: what was added, removed and changed, with before and after in each cell.

Build one like it

The smallest complete version, in each language CanopyX supports for this view. The demo above is the same API with more data.

using CanopyX;
using CanopyX.Html;

var before = new[] {
    Item("atlas", "Atlas", "Active", 24),
    Item("birch", "Birch", "Paused", 8),
    Item("delta", "Delta", "Active", 40)
};
var after = new[] {
    Item("atlas", "Atlas", "Active", 32),
    Item("birch", "Birch", "Active", 8),
    Item("elm", "Elm", "Paused", 16)
};
var comparison = CanopyDatasetComparer.Compare(
    before, after, new[] { "name", "stage", "units" });
var view = comparison.ToView("changes", "Inventory changes", new[] {
    new CanopyColumn("name", "Item") { RowHeader = true },
    new CanopyColumn("stage", "Stage"),
    new CanopyColumn("units", "Units") { Kind = CanopyColumnKind.Number }
});
view.SaveHtmlPage("compare.html");

static CanopyGridRow Item(string id, string name, string stage, int units) {
    var row = new CanopyGridRow(id);
    row.Cells["name"] = name;
    row.Cells["stage"] = stage;
    row.Cells["units"] = units;
    return row;
}

Run this snippet (dataset compare, C#)Its output, generated with the site.

Try this in the demo

  1. Changes only

    Turn on Changed only.

    Unchanged items leave the list; added, removed and changed counts stay at the top.

  2. Before and after

    Look at the Units of Atlas.

    The old value is struck through beside the new one, so a cell explains its own change.

  3. Proposals

    Under Ask the grid, preview one of the proposed views.

    The grouping or pivot shows as chips first; nothing changes until you apply it.