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
-
objectDataProviderView
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
clientIOpenBiApiClientThe client the dataprovider is open on.
dataProviderNamestringThe dataprovider's name in the session.
definitionDataProviderDefinitionThe 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
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
Dimensions
The dimensions of Definition.
public DataProviderElementCollection<DataProviderDimension> Dimensions { get; }
Property Value
KeyFigures
The key figures of Definition.
public DataProviderElementCollection<DataProviderKeyFigure> KeyFigures { get; }
Property Value
Variables
The variables of Definition.
public DataProviderElementCollection<DataProviderVariable> Variables { get; }
Property Value
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
keyFigureDataProviderKeyFiguretuplesIEnumerable<KeyValuePair<DataProviderDimension, string>>commentstringisPrivateboolidstringcancellationTokenCancellationToken
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
rowintcolumnintcommentstringisPrivateboolidstringcancellationTokenCancellationToken
Returns
- Task<DataProviderComment>
DeleteCommentAsync(string, CancellationToken)
Removes a data comment.
public Task DeleteCommentAsync(string commentId, CancellationToken cancellationToken = default)
Parameters
commentIdstringcancellationTokenCancellationToken
Returns
- Task
DeleteDimensionsAsync(IEnumerable<DataProviderDimension>, CancellationToken)
Removes dimensions from the dataprovider and from Definition.
public Task DeleteDimensionsAsync(IEnumerable<DataProviderDimension> dimensions, CancellationToken cancellationToken = default)
Parameters
dimensionsIEnumerable<DataProviderDimension>cancellationTokenCancellationToken
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
keyFiguresIEnumerable<DataProviderKeyFigure>cancellationTokenCancellationToken
Returns
- Task
DeleteVariablesAsync(IEnumerable<DataProviderVariable>, CancellationToken)
Removes variables from the dataprovider and from Definition.
public Task DeleteVariablesAsync(IEnumerable<DataProviderVariable> variables, CancellationToken cancellationToken = default)
Parameters
variablesIEnumerable<DataProviderVariable>cancellationTokenCancellationToken
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
affectedDataProvidersIEnumerable<AffectedDataProvider>Other dataproviders to carry this one's filters and drill down onto.
cancellationTokenCancellationTokenA cancellation token.
Returns
ExecuteAsync(CancellationToken)
Sends Definition and refreshes the grid.
public Task<DataProviderExecuteResult> ExecuteAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationToken
Returns
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
formatDataProviderExportFormat?gridStyleGroupIdstringcancellationTokenCancellationToken
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
requestDataProviderChartDataRequestcancellationTokenCancellationToken
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
switchMatrixbool?suppressSumsbool?suppressOpenHierarchyNodesbool?showExceptionsbool?withTuplesbool?definitionIdstringdescriptionstringcancellationTokenCancellationToken
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
refreshMetadatabool?cancellationTokenCancellationToken
Returns
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
dimensionDataProviderDimensionhierarchyNamestringwithAttributesbool?withMapsbool?cancellationTokenCancellationToken
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
requestDataProviderF4ValuesRequestcancellationTokenCancellationToken
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
variableDataProviderVariablevariableLowstringhierarchyNamestringwithAttributesbool?withMapsbool?cancellationTokenCancellationToken
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
withMapsbool?withTuplesbool?suppressRepeatedTextbool?cancellationTokenCancellationToken
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
fromRowint?noRowsint?fromColint?noColsint?withMapsbool?withTuplesbool?suppressRepeatedTextbool?cancellationTokenCancellationToken
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
fromDataRowint?noRowsint?fromDataColint?noColsint?withMapsbool?withTuplesbool?suppressRepeatedTextbool?cancellationTokenCancellationToken
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
cancellationTokenCancellationToken
Returns
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
withoutHierarchiesbool?cancellationTokenCancellationToken
Returns
- Task<DataProviderDefinition>
ResetPlanBufferAsync(CancellationToken)
Throws the buffered plan values away.
public Task ResetPlanBufferAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
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
idstringdescriptionstringcancellationTokenCancellationToken
Returns
- Task<SavedDataProviderView>
SavePlanValuesAsync(CancellationToken)
Writes the buffered plan values to the source system.
public Task SavePlanValuesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
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
rowintcolumnintplanValuedoublevalueDistributionint?cancellationTokenCancellationToken
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