Skip to content

IAnalysisService

zehavibarak edited this page Feb 15, 2025 · 1 revision

Methods

Name Usage
bool AuthorizeAsync(cube, params Axis[])
bool AuthorizeAsync(cube, AxesMap)
decimal UsageAsync(cube, params Axis[])
decimal UsageAsync(cube, axes) Tuple
decimal CalculateAsync(cube, index, params Axis[])
IDictionary<string, decimal> UsageAsync(cube, xAxis, params Axis[])
IDictionary<string, decimal> UsageAsync(cube, xAxis, yAxis, params Axis[])
decimal IndexAsync(cube, name, params Axis[])
decimal IndexAsync(cube, name, axes) Tuple
IDictionary<string, decimal> IndexAsync(cube, name, xAxis, params Axis[])
decimal GetExchangeRate(currencyCode)
decimal GetExchangeRate(currencyCode, date)
FormatAxes(columns, Axis[], StringBuilder, sqlArgs) Static
FormatAxes(columns, StringBuilder, sqlArgs, Axis[][]) Static

Querying

The example below query the cube for the first three quarters of current year usage by months.

var figures = await _analysisService.UsageAsync("cube-name", "month", DateTime.Now.Year, Axis.FromRange(1, 3));
foreach (var entry in figures) {
    Console.WriteLine($"Month: {entry.Key}, Usage: {entry.Value}");
}

Explore SQL database

public partial class TxAnalysis : AnalysisBase, AnalysisBase.IBrowsable<PO>
{
    Task<IEnumerable<PO>> IBrowsable<PO>.QueryAsync(params Axis[][] axes)
    {
        var sql = new StringBuilder("SELECT * FROM PO WHERE ");
        var sqlArgs = new List<string>();
        FormatAxes(new[]{
            "EXTRACT(YEAR FROM Due)",
            "TO_CHAR(Due, 'Q')" ,
            "EXTRACT(MONTH FROM Due)",
            default /* balance */,
            "Company",
            "Region", "Department", "Account", "Project", "Product"},
            sql, sqlArgs, axes);
        var pos = _oracle.POs.FromOracleRaw(sql.ToString(), sqlArgs.ToArray());
        return Task.FromResult(pos.AsEnumerable());
    }
}

SQL phrase support EQUALS, IN(), NOT, AND/OR LIKE, BETWEEN based on Axis.

Release Notes

Angular npm, Flutter pub.dev and Nuget packages.

Clone this wiki locally