Table of Contents

Class DataProviderView

Namespace
BiExcellence.OpenBi.Api.DataProviders
Assembly
BiExcellence.OpenBi.Api.Client.dll

A dataprovider that is open in the session, together with the definition the caller is working on.

public sealed class DataProviderView
Inheritance
object
DataProviderView

Remarks

The view is the unit of work of the reporting engine: read it once, change the definition in memory - move a dimension to another axis, add a filter, answer a variable - and call ExecuteAsync(CancellationToken), which sends the whole definition and refreshes the grid. The data is then read with GetGridDataAsync(bool?, bool?, bool?, CancellationToken) or GetChartDataAsync(DataProviderChartDataRequest, CancellationToken).

Disposing the view closes the dataprovider in the session, so a caller that opened one should await using it. Every method here is a thin wrapper over the matching IOpenBiApiClient extension - nothing is cached and nothing is done client-side except holding Definition.

Constructors

DataProviderView(IOpenBiApiClient, string, DataProviderDefinition)

Creates a view over a dataprovider that is already open in the session.

public DataProviderView(IOpenBiApiClient client, string dataProviderName, DataProviderDefinition definition)

Parameters

client IOpenBiApiClient

The client the dataprovider is open on.

dataProviderName string

The dataprovider's name in the session.

definition DataProviderDefinition

The definition to start from, usually the one the server reported.

Properties

Client

The client this dataprovider is open on.

public IOpenBiApiClient Client { get; }

Property Value

IOpenBiApiClient

DataProviderName

The dataprovider's name in the session - the dataproviders/{id} of every route.

public string DataProviderName { get; }

Property Value

string

Definition

The definition being worked on. Changing it changes nothing server-side until ExecuteAsync(CancellationToken); and an execute that reports a changed definition replaces it with what the server made of it.

public DataProviderDefinition Definition { get; set; }

Property Value

DataProviderDefinition

Dimensions

The dimensions of Definition.

public DataProviderElementCollection<DataProviderDimension> Dimensions { get; }

Property Value

DataProviderElementCollection<DataProviderDimension>

KeyFigures

The key figures of Definition.

public DataProviderElementCollection<DataProviderKeyFigure> KeyFigures { get; }

Property Value

DataProviderElementCollection<DataProviderKeyFigure>

Variables

The variables of Definition.

public DataProviderElementCollection<DataProviderVariable> Variables { get; }

Property Value

DataProviderElementCollection<DataProviderVariable>

Methods

CreateCommentAsync(DataProviderKeyFigure, IEnumerable<KeyValuePair<DataProviderDimension, string>>, string, bool, string?, CancellationToken)

Comments on the cell one key figure and one value per dimension name. Unlike the row and column form, this keeps pointing at the same data after a re-execute.

public Task<DataProviderComment> CreateCommentAsync(DataProviderKeyFigure keyFigure, IEnumerable<KeyValuePair<DataProviderDimension, string>> tuples, string comment, bool isPrivate = false, string? id = null, CancellationToken cancellationToken = default)

Parameters

keyFigure DataProviderKeyFigure
tuples IEnumerable<KeyValuePair<DataProviderDimension, string>>
comment string
isPrivate bool
id string
cancellationToken CancellationToken

Returns

Task<DataProviderComment>

CreateCommentAsync(int, int, string, bool, string?, CancellationToken)

Comments on the cell at this row and column of the executed grid. The tuples are read off the grid, so the dataprovider has to have been executed.

public Task<DataProviderComment> CreateCommentAsync(int row, int column, string comment, bool isPrivate = false, string? id = null, CancellationToken cancellationToken = default)

Parameters

row int
column int
comment string
isPrivate bool
id string
cancellationToken CancellationToken

Returns

Task<DataProviderComment>

DeleteCommentAsync(string, CancellationToken)

Removes a data comment.

public Task DeleteCommentAsync(string commentId, CancellationToken cancellationToken = default)

Parameters

commentId string
cancellationToken CancellationToken

Returns

Task

DeleteDimensionsAsync(IEnumerable<DataProviderDimension>, CancellationToken)

Removes dimensions from the dataprovider and from Definition.

public Task DeleteDimensionsAsync(IEnumerable<DataProviderDimension> dimensions, CancellationToken cancellationToken = default)

Parameters

dimensions IEnumerable<DataProviderDimension>
cancellationToken CancellationToken

Returns

Task

DeleteKeyFiguresAsync(IEnumerable<DataProviderKeyFigure>, CancellationToken)

Removes key figures from the dataprovider and from Definition.

public Task DeleteKeyFiguresAsync(IEnumerable<DataProviderKeyFigure> keyFigures, CancellationToken cancellationToken = default)

Parameters

keyFigures IEnumerable<DataProviderKeyFigure>
cancellationToken CancellationToken

Returns

Task

DeleteVariablesAsync(IEnumerable<DataProviderVariable>, CancellationToken)

Removes variables from the dataprovider and from Definition.

public Task DeleteVariablesAsync(IEnumerable<DataProviderVariable> variables, CancellationToken cancellationToken = default)

Parameters

variables IEnumerable<DataProviderVariable>
cancellationToken CancellationToken

Returns

Task

DisposeAsync()

Closes the dataprovider in the session. Failures are swallowed: a view is disposed on the way out of a scope that is often already unwinding because of an error, and the session is dropped at logout anyway.

public ValueTask DisposeAsync()

Returns

ValueTask

ExecuteAsync(IEnumerable<AffectedDataProvider>?, CancellationToken)

Sends Definition and refreshes the grid. Where the server changed the definition while executing it, the changed one is read back and replaces Definition before this returns, so the caller never works on a definition the server has already moved past.

public Task<DataProviderExecuteResult> ExecuteAsync(IEnumerable<AffectedDataProvider>? affectedDataProviders = null, CancellationToken cancellationToken = default)

Parameters

affectedDataProviders IEnumerable<AffectedDataProvider>

Other dataproviders to carry this one's filters and drill down onto.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<DataProviderExecuteResult>

ExecuteAsync(CancellationToken)

Sends Definition and refreshes the grid.

public Task<DataProviderExecuteResult> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<DataProviderExecuteResult>

ExportAsync(DataProviderExportFormat?, string?, CancellationToken)

Renders the executed grid as a document. The caller owns the returned file.

public Task<OpenBiApiFile> ExportAsync(DataProviderExportFormat? format = null, string? gridStyleGroupId = null, CancellationToken cancellationToken = default)

Parameters

format DataProviderExportFormat?
gridStyleGroupId string
cancellationToken CancellationToken

Returns

Task<OpenBiApiFile>

GetChartDataAsync(DataProviderChartDataRequest, CancellationToken)

Renders the executed grid into a chart definition that has not been stored.

public Task<DataProviderChartData> GetChartDataAsync(DataProviderChartDataRequest request, CancellationToken cancellationToken = default)

Parameters

request DataProviderChartDataRequest
cancellationToken CancellationToken

Returns

Task<DataProviderChartData>

GetChartDataAsync(bool?, bool?, bool?, bool?, bool?, string?, string?, CancellationToken)

Reads the executed grid reshaped for charting.

public Task<DataProviderChartData> GetChartDataAsync(bool? switchMatrix = null, bool? suppressSums = null, bool? suppressOpenHierarchyNodes = null, bool? showExceptions = null, bool? withTuples = null, string? definitionId = null, string? description = null, CancellationToken cancellationToken = default)

Parameters

switchMatrix bool?
suppressSums bool?
suppressOpenHierarchyNodes bool?
showExceptions bool?
withTuples bool?
definitionId string
description string
cancellationToken CancellationToken

Returns

Task<DataProviderChartData>

GetDatabaseMetaAsync(bool?, CancellationToken)

Reads the tables and views a database-backed dataprovider can read.

public Task<DataProviderDatabaseSchema> GetDatabaseMetaAsync(bool? refreshMetadata = null, CancellationToken cancellationToken = default)

Parameters

refreshMetadata bool?
cancellationToken CancellationToken

Returns

Task<DataProviderDatabaseSchema>

GetF4ValuesAsync(DataProviderDimension, string?, bool?, bool?, CancellationToken)

Reads the values a dimension can be filtered on, under everything the dataprovider is filtered to - its dimension filters included, which is why this one does not send a filter context of its own.

public Task<DataProviderF4Values> GetF4ValuesAsync(DataProviderDimension dimension, string? hierarchyName = null, bool? withAttributes = null, bool? withMaps = null, CancellationToken cancellationToken = default)

Parameters

dimension DataProviderDimension
hierarchyName string
withAttributes bool?
withMaps bool?
cancellationToken CancellationToken

Returns

Task<DataProviderF4Values>

GetF4ValuesAsync(DataProviderF4ValuesRequest, CancellationToken)

Reads a value help under a filter context of the caller's own - the variable answers to narrow the values by, where they are not the ones the dataprovider was executed with.

public Task<DataProviderF4Values> GetF4ValuesAsync(DataProviderF4ValuesRequest request, CancellationToken cancellationToken = default)

Parameters

request DataProviderF4ValuesRequest
cancellationToken CancellationToken

Returns

Task<DataProviderF4Values>

GetF4ValuesAsync(DataProviderVariable, string?, string?, bool?, bool?, CancellationToken)

Reads the values a variable can be answered with, narrowed by the answers held in Definition for the other variables - the variable being read cannot narrow its own value help. Pass a request of your own to narrow by something else, or by nothing.

public Task<DataProviderF4Values> GetF4ValuesAsync(DataProviderVariable variable, string? variableLow = null, string? hierarchyName = null, bool? withAttributes = null, bool? withMaps = null, CancellationToken cancellationToken = default)

Parameters

variable DataProviderVariable
variableLow string
hierarchyName string
withAttributes bool?
withMaps bool?
cancellationToken CancellationToken

Returns

Task<DataProviderF4Values>

GetGridDataAsync(bool?, bool?, bool?, CancellationToken)

Reads the whole executed grid, headers included.

public Task<DataProviderGridData> GetGridDataAsync(bool? withMaps = null, bool? withTuples = null, bool? suppressRepeatedText = null, CancellationToken cancellationToken = default)

Parameters

withMaps bool?
withTuples bool?
suppressRepeatedText bool?
cancellationToken CancellationToken

Returns

Task<DataProviderGridData>

GetGridDataSliceAsync(int?, int?, int?, int?, bool?, bool?, bool?, CancellationToken)

Reads a window of the executed grid, counted over the whole grid - so the window has to include the header rows and columns for the result to be readable.

public Task<DataProviderGridData> GetGridDataSliceAsync(int? fromRow = null, int? noRows = null, int? fromCol = null, int? noCols = null, bool? withMaps = null, bool? withTuples = null, bool? suppressRepeatedText = null, CancellationToken cancellationToken = default)

Parameters

fromRow int?
noRows int?
fromCol int?
noCols int?
withMaps bool?
withTuples bool?
suppressRepeatedText bool?
cancellationToken CancellationToken

Returns

Task<DataProviderGridData>

GetGridDataSliceWithHeadersAsync(int?, int?, int?, int?, bool?, bool?, bool?, CancellationToken)

Reads a window of the data area of the executed grid. The headers come with it whatever the window is, so the result is readable on its own.

public Task<DataProviderGridData> GetGridDataSliceWithHeadersAsync(int? fromDataRow = null, int? noRows = null, int? fromDataCol = null, int? noCols = null, bool? withMaps = null, bool? withTuples = null, bool? suppressRepeatedText = null, CancellationToken cancellationToken = default)

Parameters

fromDataRow int?
noRows int?
fromDataCol int?
noCols int?
withMaps bool?
withTuples bool?
suppressRepeatedText bool?
cancellationToken CancellationToken

Returns

Task<DataProviderGridData>

GetTextsAsync(CancellationToken)

Lists the documents the source attaches to this dataprovider's context.

public Task<OpenBiListResult<DataProviderDocument>> GetTextsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<OpenBiListResult<DataProviderDocument>>

RefreshDefinitionAsync(bool?, CancellationToken)

Reads the definition from the server again and makes it the current one.

public Task<DataProviderDefinition> RefreshDefinitionAsync(bool? withoutHierarchies = null, CancellationToken cancellationToken = default)

Parameters

withoutHierarchies bool?
cancellationToken CancellationToken

Returns

Task<DataProviderDefinition>

ResetPlanBufferAsync(CancellationToken)

Throws the buffered plan values away.

public Task ResetPlanBufferAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

SaveAsync(string?, string?, CancellationToken)

Stores the current state as a view that can be opened again.

public Task<SavedDataProviderView> SaveAsync(string? id = null, string? description = null, CancellationToken cancellationToken = default)

Parameters

id string
description string
cancellationToken CancellationToken

Returns

Task<SavedDataProviderView>

SavePlanValuesAsync(CancellationToken)

Writes the buffered plan values to the source system.

public Task SavePlanValuesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

SetPlanValueAsync(int, int, double, int?, CancellationToken)

Writes one planned value into the server-side buffer.

public Task SetPlanValueAsync(int row, int column, double planValue, int? valueDistribution = null, CancellationToken cancellationToken = default)

Parameters

row int
column int
planValue double
valueDistribution int?
cancellationToken CancellationToken

Returns

Task

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Events

Executed

Raised after every execute, whether it succeeded or threw.

public event EventHandler<DataProviderExecutedEventArgs>? Executed

Event Type

EventHandler<DataProviderExecutedEventArgs>

Executing

Raised before every execute.

public event EventHandler? Executing

Event Type

EventHandler