TX Sheet Control

Analytics Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll
Inherits
  1. DocumentObject
  2. Analytics

Workbook-wide deterministic data/semantic layer. Query results and profiles are detached values.

Syntax

public class Analytics

Members

Methods

MethodDescription
DataAsyncReturns at most 1,000 filtered source rows for an application-authorized inspection workflow.
ProfileAsyncProfiles up to 250,000 cells per source; mixed or identifier fields receive diagnostics.
QueryAsyncExecutes a bounded, cooperatively scheduled aggregation independently of the editor UI.
RefreshAsyncRefreshes source columns/aggregates and raises DataRefreshRequested for host-scheduled live queries.
RelationshipsAsyncLists explicitly configured many-to-one joins; suggestions are never silently applied.
RemoveRelationshipAsyncDeletes a relationship by stable ID.
RemoveSourceAsyncRemoves an explicit binding. Dependent widgets report missing-source errors.
SetDataAsyncAtomically replaces a connector's transient data; rows are detached and never persisted to TXWB. At most 256 fields / 250,000 cells; values are strings, finite numbers, booleans or null.
SetRelationshipAsyncValidates unique lookup keys before creating or replacing a relationship.
SetSourceAsyncAdds or explicitly replaces a validated source binding.
SourcesAsyncDiscovers worksheet bindings and explicitly registered logical connector queries.
SuggestRelationshipsAsyncSuggests reviewed joins only with matching key names/types, unique targets and at least 90% coverage.

Examples

Build a small report using this document API and return its PDF bytes. Pass a live control with a fresh workbook; the caller owns its lifetime.

using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateAnalyticsReportAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Range("A1:B5").SetValuesAsync(new object?[][]
    {
        ["Region", "Revenue"], ["North", 42000], ["South", 38500], ["East", 31200], ["West", 44900]
    });

    await book.Analytics.SetSourceAsync(new AnalyticsSource { Id = "sales", Name = "Regional sales", SheetId = sheet.Id, Range = "A1:B5", HasHeaderRow = true });

    var analytics = book.Analytics;
    return await control.SaveAsync(StreamType.PDF);
}

See Also