[]
        
(Showing Draft Content)

C1.PivotEngine.C1PivotEngine.Exec

Exec Method

Exec(string, string, Dictionary<string, object>, CancellationToken, ProgressDelegate)

Server-side asynchronous execution of a view returning aggregated results to the caller client.

Declaration
public static Task<Dictionary<object[], object[]>> Exec(string workspace, string table, Dictionary<string, object> view, CancellationToken cancelToken, ProgressDelegate progress)
Parameters
Type Name Description
string workspace

Path in the server's file system where DataEngine data is saved in files.

string table

The name of the DataEngine table on which the view is based.

Dictionary<string, object> view

View definition. It is obtained from a view in JSON format using System.Web.Script.Serialization.JavaScriptSerializer.Deserialize.

CancellationToken cancelToken

Enables task cancellation.

ProgressDelegate progress

Callback function to report progress updates.

Returns
Type Description
Task<Dictionary<object[], object[]>>

View execution (aggregation) result

Remarks

This method supports multi-user thread-safe execution of views on the server. Result of such execution is intended for passing to a client for visualization on the web or elsewhere.

It can execute views in multiple DataEngine workspaces and tables. It maintains a pool of Workspace objects internally to enable that.

Aggregation result is a dictionary mapping keys to values.

Each value is an array representing values of the value fields in the view in the order those fields are specified in the view. So, for example, if the view has two value fields V1 and V2, then each value is an array [v1, v2] where v1 is the aggregated value of V1 corresponding to the key, and v2 is the aggregated value of V2 corresponding to the same key.

A key is an array of values of the row and column fields in the view in the order those fields are specified in the view, with row fields coming first followed by column fields. Some or even all elements of that array can be null, which means that the corresponding value is aggregated through all values of the fields whose position in the key contains null. The key where all elements are null (such key is unique in the dictionary) corresponds to the grand total.

For example, with row field Country, column field Customer, value fields Withdrawal and Deposit with aggregation operation Sum, key ["UK", "Joe"] corresponds to [v1, v2], where v1/v2 is the sum of all withdrawals/deposits of the customer Joe in UK, key ["UK", null] corresponds to [v1, v2], where v1/v2 is the sum of all withdrawals/deposits of all UK customers, key [null, "Joe"] corresponds to [v1, v2], where v1/v2 is the sum of all withdrawals/deposits of all customers (in all countries) whose name is Joe, key [null, null] corresponds to [v1, v2], where v1/v2 is the sum of all withdrawals/deposits of all customers everywhere.

Exec(IEnumerable, Dictionary<string, object>, CancellationToken, ProgressDelegate)

Server-side asynchronous execution of a view returning aggregated results to the caller client.

Declaration
public static Task<Dictionary<object[], object[]>> Exec(IEnumerable dataSource, Dictionary<string, object> view, CancellationToken cancelToken, ProgressDelegate progress)
Parameters
Type Name Description
IEnumerable dataSource

Data source collection containing data for aggregation.

Dictionary<string, object> view

View definition. It is obtained from a view in JSON format using System.Web.Script.Serialization.JavaScriptSerializer.Deserialize.

CancellationToken cancelToken

Enables task cancellation.

ProgressDelegate progress

Callback function to report progress updates.

Returns
Type Description
Task<Dictionary<object[], object[]>>

View execution (aggregation) result

Remarks

This method supports multi-user thread-safe execution of views on the server. Result of such execution is intended for passing to a client for visualization on the web or elsewhere.

It can execute views over multiple dataSource collections. It maintains a pool of Workspace objects internally to enable that.

Aggregation result is a dictionary mapping keys to values. See a description of keys and values in C1.PivotEngine.C1PivotEngine.Exec(string, string, System.Collections.Generic.Dictionary<string,object>, System.Threading.CancellationToken)