Analytics Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
- Inherits
- Document
Object - Analytics
- Document
Workbook-wide deterministic data/semantic layer. Query results and profiles are detached values.
Syntax
public class Analytics
Members
Methods
| Method | Description |
|---|---|
| DataAsync | Returns at most 1,000 filtered source rows for an application-authorized inspection workflow. |
| ProfileAsync | Profiles up to 250,000 cells per source; mixed or identifier fields receive diagnostics. |
| QueryAsync | Executes a bounded, cooperatively scheduled aggregation independently of the editor UI. |
| RefreshAsync | Refreshes source columns/aggregates and raises DataRefreshRequested for host-scheduled live queries. |
| RelationshipsAsync | Lists explicitly configured many-to-one joins; suggestions are never silently applied. |
| RemoveRelationshipAsync | Deletes a relationship by stable ID. |
| RemoveSourceAsync | Removes an explicit binding. Dependent widgets report missing-source errors. |
| SetDataAsync | Atomically 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. |
| SetRelationshipAsync | Validates unique lookup keys before creating or replacing a relationship. |
| SetSourceAsync | Adds or explicitly replaces a validated source binding. |
| SourcesAsync | Discovers worksheet bindings and explicitly registered logical connector queries. |
| SuggestRelationshipsAsync | Suggests 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?[][]
{
[], ["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);
}