Table of Contents

Class ReportExpressionContext

Namespace
DocWright.Reporting.Expressions
Assembly
DocWright.Reporting.dll

Everything an expression can reach outside itself: the culture, the clock, the user, the parameters, the data, and page numbers once a report is paginated.

public sealed class ReportExpressionContext
Inheritance
ReportExpressionContext
Inherited Members

Remarks

Nothing here is ambient. The evaluator reads no clock, no environment, no thread culture and no identity. Now(), Today() and Globals!ExecutionTime all read ExecutionTime, which the host supplies, so one definition over one dataset evaluates identically on every run. The reference implementation reads the real clock for Now() (measured: Now() = Globals!ExecutionTime is False there); DocWright binds both to the same instant on purpose.

The culture is Culture, which defaults to en-US: measured, a report that states no <Language> evaluates its expressions in en-US in the reference implementation even when the server runs under another culture. A report processor sets it from the report's language; the thread's culture is never consulted.

A context is not thread-safe to mutate. Share one across threads only while nobody writes to it, or give each worker its own through WithScope(ReportDataScope?).

Constructors

ReportExpressionContext()

Initializes a context with the en-US culture and nothing else supplied.

Properties

CodeHost

Gets or sets the host that runs the report's custom code. Null — the default — refuses every Code. call with DXP9103.

Culture

Gets or sets the culture conversions and formatting use: CDbl("1,5"), Format(x, "N2"), MonthName(3), UCase. Defaults to en-US.

Definition

Gets or sets the definition the expression belongs to, which DataSets! and DataSources! read from. Null refuses those references with DXP9106.

ExecutionTime

Gets or sets the instant the report runs at, which Globals!ExecutionTime, Now() and Today() return. Null means the host did not supply one, and an expression that reads it is refused with DXP9106 rather than given the clock.

Limits

Gets or sets the budgets evaluation is bounded by, or null for the defaults.

OverallPageNumber

Gets or sets Globals!OverallPageNumber; null outside pagination.

OverallTotalPages

Gets or sets Globals!OverallTotalPages; null outside pagination.

PageName

Gets or sets Globals!PageName. Readable only while PageNumber is set, for the same reason the page numbers are.

PageNumber

Gets or sets Globals!PageNumber. Null outside pagination, where reading it is refused with DXP9104 — the reference rejects the report for the same reason (measured) rather than printing a zero.

Parameters

Gets the report's parameter values by name, for Parameters!Name.Value. Names are case-sensitive, as they are in the reference: Parameters!region does not read a parameter named Region.

RenderFormatIsInteractive

Gets or sets Globals!RenderFormat.IsInteractive.

RenderFormatName

Gets or sets Globals!RenderFormat.Name, such as PDF or HTML5.

ReportFolder

Gets or sets Globals!ReportFolder.

ReportName

Gets or sets Globals!ReportName.

ReportServerUrl

Gets or sets Globals!ReportServerUrl.

Scope

Gets or sets the data an expression is evaluated against: fields, aggregates, report items and variables. Null outside any data scope.

TotalPages

Gets or sets Globals!TotalPages; null outside pagination.

UserId

Gets or sets User!UserID.

UserLanguage

Gets or sets User!Language.

Methods

WithScope(ReportDataScope?)

Returns a copy of this context bound to another data scope, sharing everything else (including the parameter dictionary).